jotbus 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +53 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
-
var Zb=Object.create;var ia=Object.defineProperty;var Db=Object.getOwnPropertyDescriptor;var Mb=Object.getOwnPropertyNames;var Lb=Object.getPrototypeOf,Ub=Object.prototype.hasOwnProperty;var E=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},aa=(e,t)=>{for(var r in t)ia(e,r,{get:t[r],enumerable:!0})},qb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mb(t))!Ub.call(e,o)&&o!==r&&ia(e,o,{get:()=>t[o],enumerable:!(n=Db(t,o))||n.enumerable});return e};var ca=(e,t,r)=>(r=e!=null?Zb(Lb(e)):{},qb(t||!e||!e.__esModule?ia(r,"default",{value:e,enumerable:!0}):r,e));var so=E(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.regexpCode=J.getEsmExportName=J.getProperty=J.safeStringify=J.stringify=J.strConcat=J.addCodeArg=J.str=J._=J.nil=J._Code=J.Name=J.IDENTIFIER=J._CodeOrName=void 0;var no=class{};J._CodeOrName=no;J.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var lr=class extends no{constructor(t){if(super(),!J.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}}};J.Name=lr;var Je=class extends no{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,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof lr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};J._Code=Je;J.nil=new Je("");function iy(e,...t){let r=[e[0]],n=0;for(;n<t.length;)pu(r,t[n]),r.push(e[++n]);return new Je(r)}J._=iy;var fu=new Je("+");function ay(e,...t){let r=[oo(e[0])],n=0;for(;n<t.length;)r.push(fu),pu(r,t[n]),r.push(fu,oo(e[++n]));return yS(r),new Je(r)}J.str=ay;function pu(e,t){t instanceof Je?e.push(...t._items):t instanceof lr?e.push(t):e.push(wS(t))}J.addCodeArg=pu;function yS(e){let t=1;for(;t<e.length-1;){if(e[t]===fu){let r=_S(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function _S(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof lr||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 lr))return`"${e}${t.slice(1)}`}function bS(e,t){return t.emptyStr()?e:e.emptyStr()?t:ay`${e}${t}`}J.strConcat=bS;function wS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:oo(Array.isArray(e)?e.join(","):e)}function xS(e){return new Je(oo(e))}J.stringify=xS;function oo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}J.safeStringify=oo;function vS(e){return typeof e=="string"&&J.IDENTIFIER.test(e)?new Je(`.${e}`):iy`[${e}]`}J.getProperty=vS;function $S(e){if(typeof e=="string"&&J.IDENTIFIER.test(e))return new Je(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}J.getEsmExportName=$S;function SS(e){return new Je(e.toString())}J.regexpCode=SS});var gu=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.ValueScope=De.ValueScopeName=De.Scope=De.varKinds=De.UsedValueState=void 0;var Ze=so(),hu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},li;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(li||(De.UsedValueState=li={}));De.varKinds={const:new Ze.Name("const"),let:new Ze.Name("let"),var:new Ze.Name("var")};var di=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Ze.Name?t:this.name(t)}name(t){return new Ze.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};De.Scope=di;var fi=class extends Ze.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Ze._)`.${new Ze.Name(r)}[${n}]`}};De.ValueScopeName=fi;var zS=(0,Ze._)`\n`,mu=class extends di{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?zS:Ze.nil}}get(){return this._scope}name(t){return new fi(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ze._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=Ze.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,li.Started);let l=r(u);if(l){let d=this.opts.es5?De.varKinds.var:De.varKinds.const;s=(0,Ze._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ze._)`${s}${l}${this.opts._n}`;else throw new hu(u);c.set(u,li.Completed)})}return s}};De.ValueScope=mu});var L=E(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.or=U.and=U.not=U.CodeGen=U.operators=U.varKinds=U.ValueScopeName=U.ValueScope=U.Scope=U.Name=U.regexpCode=U.stringify=U.getProperty=U.nil=U.strConcat=U.str=U._=void 0;var F=so(),nt=gu(),Ht=so();Object.defineProperty(U,"_",{enumerable:!0,get:function(){return Ht._}});Object.defineProperty(U,"str",{enumerable:!0,get:function(){return Ht.str}});Object.defineProperty(U,"strConcat",{enumerable:!0,get:function(){return Ht.strConcat}});Object.defineProperty(U,"nil",{enumerable:!0,get:function(){return Ht.nil}});Object.defineProperty(U,"getProperty",{enumerable:!0,get:function(){return Ht.getProperty}});Object.defineProperty(U,"stringify",{enumerable:!0,get:function(){return Ht.stringify}});Object.defineProperty(U,"regexpCode",{enumerable:!0,get:function(){return Ht.regexpCode}});Object.defineProperty(U,"Name",{enumerable:!0,get:function(){return Ht.Name}});var gi=gu();Object.defineProperty(U,"Scope",{enumerable:!0,get:function(){return gi.Scope}});Object.defineProperty(U,"ValueScope",{enumerable:!0,get:function(){return gi.ValueScope}});Object.defineProperty(U,"ValueScopeName",{enumerable:!0,get:function(){return gi.ValueScopeName}});Object.defineProperty(U,"varKinds",{enumerable:!0,get:function(){return gi.varKinds}});U.operators={GT:new F._Code(">"),GTE:new F._Code(">="),LT:new F._Code("<"),LTE:new F._Code("<="),EQ:new F._Code("==="),NEQ:new F._Code("!=="),NOT:new F._Code("!"),OR:new F._Code("||"),AND:new F._Code("&&"),ADD:new F._Code("+")};var Et=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},yu=class extends Et{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?nt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=en(this.rhs,t,r)),this}get names(){return this.rhs instanceof F._CodeOrName?this.rhs.names:{}}},pi=class extends Et{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof F.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=en(this.rhs,t,r),this}get names(){let t=this.lhs instanceof F.Name?{}:{...this.lhs.names};return mi(t,this.rhs)}},_u=class extends pi{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bu=class extends Et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},wu=class extends Et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xu=class extends Et{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},vu=class extends Et{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=en(this.code,t,r),this}get names(){return this.code instanceof F._CodeOrName?this.code.names:{}}},io=class extends Et{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(kS(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>pr(t,r.names),{})}},Tt=class extends io{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},$u=class extends io{},Qr=class extends Tt{};Qr.kind="else";var dr=class e extends Tt{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 n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Qr(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(cy(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=en(this.condition,t,r),this}get names(){let t=super.names;return mi(t,this.condition),this.else&&pr(t,this.else.names),t}};dr.kind="if";var fr=class extends Tt{};fr.kind="for";var Su=class extends fr{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=en(this.iteration,t,r),this}get names(){return pr(super.names,this.iteration.names)}},zu=class extends fr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?nt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=mi(super.names,this.from);return mi(t,this.to)}},hi=class extends fr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}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=en(this.iterable,t,r),this}get names(){return pr(super.names,this.iterable.names)}},ao=class extends Tt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};ao.kind="func";var co=class extends io{render(t){return"return "+super.render(t)}};co.kind="return";var ku=class extends Tt{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 n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&pr(t,this.catch.names),this.finally&&pr(t,this.finally.names),t}},uo=class extends Tt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};uo.kind="catch";var lo=class extends Tt{render(t){return"finally"+super.render(t)}};lo.kind="finally";var Pu=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
-
`:""},this._extScope=t,this._scope=new nt.Scope({parent:t}),this._nodes=[new $u]}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 n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new yu(t,s,n)),s}const(t,r,n){return this._def(nt.varKinds.const,t,r,n)}let(t,r,n){return this._def(nt.varKinds.let,t,r,n)}var(t,r,n){return this._def(nt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new pi(t,r,n))}add(t,r){return this._leafNode(new _u(t,U.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==F.nil&&this._leafNode(new vu(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,F.addCodeArg)(r,o));return r.push("}"),new F._Code(r)}if(t,r,n){if(this._blockNode(new dr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new dr(t))}else(){return this._elseNode(new Qr)}endIf(){return this._endBlockNode(dr,Qr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Su(t),r)}forRange(t,r,n,o,s=this.opts.es5?nt.varKinds.var:nt.varKinds.let){let i=this._scope.toName(t);return this._for(new zu(s,i,r,n),()=>o(i))}forOf(t,r,n,o=nt.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof F.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,F._)`${i}.length`,a=>{this.var(s,(0,F._)`${i}[${a}]`),n(s)})}return this._for(new hi("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?nt.varKinds.var:nt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,F._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new hi("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(fr)}label(t){return this._leafNode(new bu(t))}break(t){return this._leafNode(new wu(t))}return(t){let r=new co;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(co)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new ku;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new uo(s),r(s)}return n&&(this._currNode=o.finally=new lo,this.code(n)),this._endBlockNode(uo,lo)}throw(t){return this._leafNode(new xu(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 n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=F.nil,n,o){return this._blockNode(new ao(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ao)}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 n=this._currNode;if(n instanceof t||r&&n 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 dr))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}};U.CodeGen=Pu;function pr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function mi(e,t){return t instanceof F._CodeOrName?pr(e,t.names):e}function en(e,t,r){if(e instanceof F.Name)return n(e);if(!o(e))return e;return new F._Code(e._items.reduce((s,i)=>(i instanceof F.Name&&(i=n(i)),i instanceof F._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof F._Code&&s._items.some(i=>i instanceof F.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function kS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function cy(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,F._)`!${Eu(e)}`}U.not=cy;var PS=uy(U.operators.AND);function ES(...e){return e.reduce(PS)}U.and=ES;var TS=uy(U.operators.OR);function OS(...e){return e.reduce(TS)}U.or=OS;function uy(e){return(t,r)=>t===F.nil?r:r===F.nil?t:(0,F._)`${Eu(t)} ${e} ${Eu(r)}`}function Eu(e){return e instanceof F.Name?e:(0,F._)`(${e})`}});var B=E(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 Q=L(),RS=so();function AS(e){let t={};for(let r of e)t[r]=!0;return t}q.toHash=AS;function CS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(fy(e,t),!py(t,e.self.RULES.all))}q.alwaysValidSchema=CS;function fy(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||gy(e,`unknown keyword: "${s}"`)}q.checkUnknownRules=fy;function py(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}q.schemaHasRules=py;function IS(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=IS;function NS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Q._)`${r}`}return(0,Q._)`${e}${t}${(0,Q.getProperty)(n)}`}q.schemaRefOrVal=NS;function jS(e){return hy(decodeURIComponent(e))}q.unescapeFragment=jS;function ZS(e){return encodeURIComponent(Ou(e))}q.escapeFragment=ZS;function Ou(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=Ou;function hy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=hy;function DS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}q.eachItem=DS;function ly({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof Q.Name?(s instanceof Q.Name?e(o,s,i):t(o,s,i),i):s instanceof Q.Name?(t(o,i,s),s):r(s,i);return a===Q.Name&&!(c instanceof Q.Name)?n(o,c):c}}q.mergeEvaluated={props:ly({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Q._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Q._)`${r} || {}`).code((0,Q._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Q._)`${r} || {}`),Ru(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:my}),items:ly({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Q._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Q._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function my(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Q._)`{}`);return t!==void 0&&Ru(e,r,t),r}q.evaluatedPropsToName=my;function Ru(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Q._)`${t}${(0,Q.getProperty)(n)}`,!0))}q.setEvaluated=Ru;var dy={};function MS(e,t){return e.scopeValue("func",{ref:t,code:dy[t.code]||(dy[t.code]=new RS._Code(t.code))})}q.useFunc=MS;var Tu;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Tu||(q.Type=Tu={}));function LS(e,t,r){if(e instanceof Q.Name){let n=t===Tu.Num;return r?n?(0,Q._)`"[" + ${e} + "]"`:(0,Q._)`"['" + ${e} + "']"`:n?(0,Q._)`"/" + ${e}`:(0,Q._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Q.getProperty)(e).toString():"/"+Ou(e)}q.getErrorPath=LS;function gy(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=gy});var Ot=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});var ke=L(),US={data:new ke.Name("data"),valCxt:new ke.Name("valCxt"),instancePath:new ke.Name("instancePath"),parentData:new ke.Name("parentData"),parentDataProperty:new ke.Name("parentDataProperty"),rootData:new ke.Name("rootData"),dynamicAnchors:new ke.Name("dynamicAnchors"),vErrors:new ke.Name("vErrors"),errors:new ke.Name("errors"),this:new ke.Name("this"),self:new ke.Name("self"),scope:new ke.Name("scope"),json:new ke.Name("json"),jsonPos:new ke.Name("jsonPos"),jsonLen:new ke.Name("jsonLen"),jsonPart:new ke.Name("jsonPart")};Au.default=US});var fo=E(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.extendErrors=Pe.resetErrorsCount=Pe.reportExtraError=Pe.reportError=Pe.keyword$DataError=Pe.keywordError=void 0;var V=L(),yi=B(),Ae=Ot();Pe.keywordError={message:({keyword:e})=>(0,V.str)`must pass "${e}" keyword validation`};Pe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,V.str)`"${e}" keyword must be ${t} ($data)`:(0,V.str)`"${e}" keyword is invalid ($data)`};function qS(e,t=Pe.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=by(e,t,r);n??(i||a)?yy(s,c):_y(o,(0,V._)`[${c}]`)}Pe.reportError=qS;function FS(e,t=Pe.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=by(e,t,r);yy(o,a),s||i||_y(n,Ae.default.vErrors)}Pe.reportExtraError=FS;function BS(e,t){e.assign(Ae.default.errors,t),e.if((0,V._)`${Ae.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,V._)`${Ae.default.vErrors}.length`,t),()=>e.assign(Ae.default.vErrors,null)))}Pe.resetErrorsCount=BS;function VS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Ae.default.errors,a=>{e.const(i,(0,V._)`${Ae.default.vErrors}[${a}]`),e.if((0,V._)`${i}.instancePath === undefined`,()=>e.assign((0,V._)`${i}.instancePath`,(0,V.strConcat)(Ae.default.instancePath,s.errorPath))),e.assign((0,V._)`${i}.schemaPath`,(0,V.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,V._)`${i}.schema`,r),e.assign((0,V._)`${i}.data`,n))})}Pe.extendErrors=VS;function yy(e,t){let r=e.const("err",t);e.if((0,V._)`${Ae.default.vErrors} === null`,()=>e.assign(Ae.default.vErrors,(0,V._)`[${r}]`),(0,V._)`${Ae.default.vErrors}.push(${r})`),e.code((0,V._)`${Ae.default.errors}++`)}function _y(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,V._)`new ${e.ValidationError}(${t})`):(r.assign((0,V._)`${n}.errors`,t),r.return(!1))}var hr={keyword:new V.Name("keyword"),schemaPath:new V.Name("schemaPath"),params:new V.Name("params"),propertyName:new V.Name("propertyName"),message:new V.Name("message"),schema:new V.Name("schema"),parentSchema:new V.Name("parentSchema")};function by(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,V._)`{}`:HS(e,t,r)}function HS(e,t,r={}){let{gen:n,it:o}=e,s=[KS(o,r),JS(e,r)];return WS(e,t,s),n.object(...s)}function KS({errorPath:e},{instancePath:t}){let r=t?(0,V.str)`${e}${(0,yi.getErrorPath)(t,yi.Type.Str)}`:e;return[Ae.default.instancePath,(0,V.strConcat)(Ae.default.instancePath,r)]}function JS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,V.str)`${t}/${e}`;return r&&(o=(0,V.str)`${o}${(0,yi.getErrorPath)(r,yi.Type.Str)}`),[hr.schemaPath,o]}function WS(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([hr.keyword,o],[hr.params,typeof t=="function"?t(e):t||(0,V._)`{}`]),c.messages&&n.push([hr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([hr.schema,i],[hr.parentSchema,(0,V._)`${l}${d}`],[Ae.default.data,s]),u&&n.push([hr.propertyName,u])}});var xy=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.boolOrEmptySchema=tn.topBoolOrEmptySchema=void 0;var GS=fo(),XS=L(),YS=Ot(),QS={message:"boolean schema is false"};function ez(e){let{gen:t,schema:r,validateName:n}=e;r===!1?wy(e,!1):typeof r=="object"&&r.$async===!0?t.return(YS.default.data):(t.assign((0,XS._)`${n}.errors`,null),t.return(!0))}tn.topBoolOrEmptySchema=ez;function tz(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),wy(e)):r.var(t,!0)}tn.boolOrEmptySchema=tz;function wy(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,GS.reportError)(o,QS,void 0,t)}});var Cu=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.getRules=rn.isJSONType=void 0;var rz=["string","number","integer","boolean","null","object","array"],nz=new Set(rz);function oz(e){return typeof e=="string"&&nz.has(e)}rn.isJSONType=oz;function sz(){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:{}}}rn.getRules=sz});var Iu=E(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.shouldUseRule=Kt.shouldUseGroup=Kt.schemaHasRulesForType=void 0;function iz({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&vy(e,n)}Kt.schemaHasRulesForType=iz;function vy(e,t){return t.rules.some(r=>$y(e,r))}Kt.shouldUseGroup=vy;function $y(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Kt.shouldUseRule=$y});var po=E(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.reportTypeError=Ee.checkDataTypes=Ee.checkDataType=Ee.coerceAndCheckDataType=Ee.getJSONTypes=Ee.getSchemaTypes=Ee.DataType=void 0;var az=Cu(),cz=Iu(),uz=fo(),M=L(),Sy=B(),nn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(nn||(Ee.DataType=nn={}));function lz(e){let t=zy(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}Ee.getSchemaTypes=lz;function zy(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(az.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ee.getJSONTypes=zy;function dz(e,t){let{gen:r,data:n,opts:o}=e,s=fz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,cz.schemaHasRulesForType)(e,t[0]));if(i){let a=ju(t,n,o.strictNumbers,nn.Wrong);r.if(a,()=>{s.length?pz(e,t,s):Zu(e)})}return i}Ee.coerceAndCheckDataType=dz;var ky=new Set(["string","number","integer","boolean","null"]);function fz(e,t){return t?e.filter(r=>ky.has(r)||t==="array"&&r==="array"):[]}function pz(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,M._)`typeof ${o}`),a=n.let("coerced",(0,M._)`undefined`);s.coerceTypes==="array"&&n.if((0,M._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,M._)`${o}[0]`).assign(i,(0,M._)`typeof ${o}`).if(ju(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,M._)`${a} !== undefined`);for(let u of r)(ky.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Zu(e),n.endIf(),n.if((0,M._)`${a} !== undefined`,()=>{n.assign(o,a),hz(e,a)});function c(u){switch(u){case"string":n.elseIf((0,M._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,M._)`"" + ${o}`).elseIf((0,M._)`${o} === null`).assign(a,(0,M._)`""`);return;case"number":n.elseIf((0,M._)`${i} == "boolean" || ${o} === null
|
|
5
|
-
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,
|
|
6
|
-
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,
|
|
7
|
-
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,M._)`[${o}]`)}}}function hz({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,M._)`${t} !== undefined`,()=>e.assign((0,M._)`${t}[${r}]`,n))}function Nu(e,t,r,n=nn.Correct){let o=n===nn.Correct?M.operators.EQ:M.operators.NEQ,s;switch(e){case"null":return(0,M._)`${t} ${o} null`;case"array":s=(0,M._)`Array.isArray(${t})`;break;case"object":s=(0,M._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,M._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,M._)`typeof ${t} ${o} ${e}`}return n===nn.Correct?s:(0,M.not)(s);function i(a=M.nil){return(0,M.and)((0,M._)`typeof ${t} == "number"`,a,r?(0,M._)`isFinite(${t})`:M.nil)}}Ee.checkDataType=Nu;function ju(e,t,r,n){if(e.length===1)return Nu(e[0],t,r,n);let o,s=(0,Sy.toHash)(e);if(s.array&&s.object){let i=(0,M._)`typeof ${t} != "object"`;o=s.null?i:(0,M._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=M.nil;s.number&&delete s.integer;for(let i in s)o=(0,M.and)(o,Nu(i,t,r,n));return o}Ee.checkDataTypes=ju;var mz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,M._)`{type: ${e}}`:(0,M._)`{type: ${t}}`};function Zu(e){let t=gz(e);(0,uz.reportError)(t,mz)}Ee.reportTypeError=Zu;function gz(e){let{gen:t,data:r,schema:n}=e,o=(0,Sy.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Ey=E(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.assignDefaults=void 0;var on=L(),yz=B();function _z(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Py(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Py(e,s,o.default))}_i.assignDefaults=_z;function Py(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,on._)`${s}${(0,on.getProperty)(t)}`;if(o){(0,yz.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,on._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,on._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,on._)`${a} = ${(0,on.stringify)(r)}`)}});var We=E(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.validateUnion=G.validateArray=G.usePattern=G.callValidateCode=G.schemaProperties=G.allSchemaProperties=G.noPropertyInData=G.propertyInData=G.isOwnProperty=G.hasPropFunc=G.reportMissingProp=G.checkMissingProp=G.checkReportMissingProp=void 0;var ne=L(),Du=B(),Jt=Ot(),bz=B();function wz(e,t){let{gen:r,data:n,it:o}=e;r.if(Lu(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ne._)`${t}`},!0),e.error()})}G.checkReportMissingProp=wz;function xz({gen:e,data:t,it:{opts:r}},n,o){return(0,ne.or)(...n.map(s=>(0,ne.and)(Lu(e,t,s,r.ownProperties),(0,ne._)`${o} = ${s}`)))}G.checkMissingProp=xz;function vz(e,t){e.setParams({missingProperty:t},!0),e.error()}G.reportMissingProp=vz;function Ty(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ne._)`Object.prototype.hasOwnProperty`})}G.hasPropFunc=Ty;function Mu(e,t,r){return(0,ne._)`${Ty(e)}.call(${t}, ${r})`}G.isOwnProperty=Mu;function $z(e,t,r,n){let o=(0,ne._)`${t}${(0,ne.getProperty)(r)} !== undefined`;return n?(0,ne._)`${o} && ${Mu(e,t,r)}`:o}G.propertyInData=$z;function Lu(e,t,r,n){let o=(0,ne._)`${t}${(0,ne.getProperty)(r)} === undefined`;return n?(0,ne.or)(o,(0,ne.not)(Mu(e,t,r))):o}G.noPropertyInData=Lu;function Oy(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}G.allSchemaProperties=Oy;function Sz(e,t){return Oy(t).filter(r=>!(0,Du.alwaysValidSchema)(e,t[r]))}G.schemaProperties=Sz;function zz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,ne._)`${e}, ${t}, ${n}${o}`:t,d=[[Jt.default.instancePath,(0,ne.strConcat)(Jt.default.instancePath,s)],[Jt.default.parentData,i.parentData],[Jt.default.parentDataProperty,i.parentDataProperty],[Jt.default.rootData,Jt.default.rootData]];i.opts.dynamicRef&&d.push([Jt.default.dynamicAnchors,Jt.default.dynamicAnchors]);let p=(0,ne._)`${l}, ${r.object(...d)}`;return c!==ne.nil?(0,ne._)`${a}.call(${c}, ${p})`:(0,ne._)`${a}(${p})`}G.callValidateCode=zz;var kz=(0,ne._)`new RegExp`;function Pz({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ne._)`${o.code==="new RegExp"?kz:(0,bz.useFunc)(e,o)}(${r}, ${n})`})}G.usePattern=Pz;function Ez(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.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,ne._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Du.Type.Num},s),t.if((0,ne.not)(s),a)})}}G.validateArray=Ez;function Tz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Du.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ne._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ne.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}G.validateUnion=Tz});var Cy=E(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.validateKeywordUsage=ft.validSchemaType=ft.funcKeywordCode=ft.macroKeywordCode=void 0;var Ce=L(),mr=Ot(),Oz=We(),Rz=fo();function Az(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Ay(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Ce.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}ft.macroKeywordCode=Az;function Cz(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Nz(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Ay(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)m(),t.modifying&&Ry(e),y(()=>e.error());else{let w=t.async?f():h();t.modifying&&Ry(e),y(()=>Iz(e,w))}}function f(){let w=n.let("ruleErrs",null);return n.try(()=>m((0,Ce._)`await `),v=>n.assign(d,!1).if((0,Ce._)`${v} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,Ce._)`${v}.errors`),()=>n.throw(v))),w}function h(){let w=(0,Ce._)`${l}.errors`;return n.assign(w,null),m(Ce.nil),w}function m(w=t.async?(0,Ce._)`await `:Ce.nil){let v=c.opts.passContext?mr.default.this:mr.default.self,S=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,Ce._)`${w}${(0,Oz.callValidateCode)(e,l,v,S)}`,t.modifying)}function y(w){var v;n.if((0,Ce.not)((v=t.valid)!==null&&v!==void 0?v:d),w)}}ft.funcKeywordCode=Cz;function Ry(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ce._)`${n.parentData}[${n.parentDataProperty}]`))}function Iz(e,t){let{gen:r}=e;r.if((0,Ce._)`Array.isArray(${t})`,()=>{r.assign(mr.default.vErrors,(0,Ce._)`${mr.default.vErrors} === null ? ${t} : ${mr.default.vErrors}.concat(${t})`).assign(mr.default.errors,(0,Ce._)`${mr.default.vErrors}.length`),(0,Rz.extendErrors)(e)},()=>e.error())}function Nz({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ay(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,Ce.stringify)(r)})}function jz(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}ft.validSchemaType=jz;function Zz({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}ft.validateKeywordUsage=Zz});var Ny=E(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.extendSubschemaMode=Wt.extendSubschemaData=Wt.getSubschema=void 0;var pt=L(),Iy=B();function Dz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==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,pt._)`${e.schemaPath}${(0,pt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,pt._)`${e.schemaPath}${(0,pt.getProperty)(t)}${(0,pt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Iy.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Wt.getSubschema=Dz;function Mz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==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:u,dataPathArr:l,opts:d}=t,p=a.let("data",(0,pt._)`${t.data}${(0,pt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,pt.str)`${u}${(0,Iy.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,pt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof pt.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Wt.extendSubschemaData=Mz;function Lz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Wt.extendSubschemaMode=Lz});var Uu=E((Jj,jy)=>{"use strict";jy.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 n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))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),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Dy=E((Wj,Zy)=>{"use strict";var Gt=Zy.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};bi(t,n,o,e,"",e)};Gt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Gt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Gt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Gt.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 bi(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Gt.arrayKeywords)for(var p=0;p<d.length;p++)bi(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in Gt.propsKeywords){if(d&&typeof d=="object")for(var f in d)bi(e,t,r,d[f],o+"/"+l+"/"+Uz(f),s,o,l,n,f)}else(l in Gt.keywords||e.allKeys&&!(l in Gt.skipKeywords))&&bi(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Uz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ho=E(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.getSchemaRefs=Me.resolveUrl=Me.normalizeId=Me._getFullPath=Me.getFullPath=Me.inlineRef=void 0;var qz=B(),Fz=Uu(),Bz=Dy(),Vz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Hz(e,t=!0){return typeof e=="boolean"?!0:t===!0?!qu(e):t?My(e)<=t:!1}Me.inlineRef=Hz;var Kz=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qu(e){for(let t in e){if(Kz.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(qu)||typeof r=="object"&&qu(r))return!0}return!1}function My(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Vz.has(r)&&(typeof e[r]=="object"&&(0,qz.eachItem)(e[r],n=>t+=My(n)),t===1/0))return 1/0}return t}function Ly(e,t="",r){r!==!1&&(t=sn(t));let n=e.parse(t);return Uy(e,n)}Me.getFullPath=Ly;function Uy(e,t){return e.serialize(t).split("#")[0]+"#"}Me._getFullPath=Uy;var Jz=/#\/?$/;function sn(e){return e?e.replace(Jz,""):""}Me.normalizeId=sn;function Wz(e,t,r){return r=sn(r),e.resolve(t,r)}Me.resolveUrl=Wz;var Gz=/^[a-z_][-a-z0-9._]*$/i;function Xz(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=sn(e[r]||t),s={"":o},i=Ly(n,o,!1),a={},c=new Set;return Bz(e,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let m=i+p,y=s[h];typeof d[r]=="string"&&(y=w.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),s[p]=y;function w(S){let T=this.opts.uriResolver.resolve;if(S=sn(y?T(y,S):S),c.has(S))throw l(S);c.add(S);let _=this.refs[S];return typeof _=="string"&&(_=this.refs[_]),typeof _=="object"?u(d,_.schema,S):S!==sn(m)&&(S[0]==="#"?(u(d,a[S],S),a[S]=d):this.refs[S]=m),S}function v(S){if(typeof S=="string"){if(!Gz.test(S))throw new Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function u(d,p,f){if(p!==void 0&&!Fz(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Me.getSchemaRefs=Xz});var yo=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getData=Xt.KeywordCxt=Xt.validateFunctionCode=void 0;var Hy=xy(),qy=po(),Bu=Iu(),wi=po(),Yz=Ey(),go=Cy(),Fu=Ny(),C=L(),Z=Ot(),Qz=ho(),Rt=B(),mo=fo();function ek(e){if(Wy(e)&&(Gy(e),Jy(e))){nk(e);return}Ky(e,()=>(0,Hy.topBoolOrEmptySchema)(e))}Xt.validateFunctionCode=ek;function Ky({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,C._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{e.code((0,C._)`"use strict"; ${Fy(r,o)}`),rk(e,o),e.code(s)}):e.func(t,(0,C._)`${Z.default.data}, ${tk(o)}`,n.$async,()=>e.code(Fy(r,o)).code(s))}function tk(e){return(0,C._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${e.dynamicRef?(0,C._)`, ${Z.default.dynamicAnchors}={}`:C.nil}}={}`}function rk(e,t){e.if(Z.default.valCxt,()=>{e.var(Z.default.instancePath,(0,C._)`${Z.default.valCxt}.${Z.default.instancePath}`),e.var(Z.default.parentData,(0,C._)`${Z.default.valCxt}.${Z.default.parentData}`),e.var(Z.default.parentDataProperty,(0,C._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),e.var(Z.default.rootData,(0,C._)`${Z.default.valCxt}.${Z.default.rootData}`),t.dynamicRef&&e.var(Z.default.dynamicAnchors,(0,C._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`)},()=>{e.var(Z.default.instancePath,(0,C._)`""`),e.var(Z.default.parentData,(0,C._)`undefined`),e.var(Z.default.parentDataProperty,(0,C._)`undefined`),e.var(Z.default.rootData,Z.default.data),t.dynamicRef&&e.var(Z.default.dynamicAnchors,(0,C._)`{}`)})}function nk(e){let{schema:t,opts:r,gen:n}=e;Ky(e,()=>{r.$comment&&t.$comment&&Yy(e),ck(e),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&ok(e),Xy(e),dk(e)})}function ok(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,C._)`${r}.evaluated`),t.if((0,C._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,C._)`${e.evaluated}.props`,(0,C._)`undefined`)),t.if((0,C._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,C._)`${e.evaluated}.items`,(0,C._)`undefined`))}function Fy(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,C._)`/*# sourceURL=${r} */`:C.nil}function sk(e,t){if(Wy(e)&&(Gy(e),Jy(e))){ik(e,t);return}(0,Hy.boolOrEmptySchema)(e,t)}function Jy({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 Wy(e){return typeof e.schema!="boolean"}function ik(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Yy(e),uk(e),lk(e);let s=n.const("_errs",Z.default.errors);Xy(e,s),n.var(t,(0,C._)`${s} === ${Z.default.errors}`)}function Gy(e){(0,Rt.checkUnknownRules)(e),ak(e)}function Xy(e,t){if(e.opts.jtd)return By(e,[],!1,t);let r=(0,qy.getSchemaTypes)(e.schema),n=(0,qy.coerceAndCheckDataType)(e,r);By(e,r,!n,t)}function ak(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Rt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function ck(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Rt.checkStrictMode)(e,"default is ignored in the schema root")}function uk(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Qz.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function lk(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Yy({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,C._)`${Z.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,C.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,C._)`${Z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function dk(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,C._)`${Z.default.errors} === 0`,()=>t.return(Z.default.data),()=>t.throw((0,C._)`new ${o}(${Z.default.vErrors})`)):(t.assign((0,C._)`${n}.errors`,Z.default.vErrors),s.unevaluated&&fk(e),t.return((0,C._)`${Z.default.errors} === 0`))}function fk({gen:e,evaluated:t,props:r,items:n}){r instanceof C.Name&&e.assign((0,C._)`${t}.props`,r),n instanceof C.Name&&e.assign((0,C._)`${t}.items`,n)}function By(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Rt.schemaHasRulesButRef)(s,l))){o.block(()=>e_(e,"$ref",l.all.$ref.definition));return}c.jtd||pk(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Bu.shouldUseGroup)(s,p)&&(p.type?(o.if((0,wi.checkDataType)(p.type,i,c.strictNumbers)),Vy(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,wi.reportTypeError)(e)),o.endIf()):Vy(e,p),a||o.if((0,C._)`${Z.default.errors} === ${n||0}`))}}function Vy(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,Yz.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Bu.shouldUseRule)(n,s)&&e_(e,s.keyword,s.definition,t.type)})}function pk(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(hk(e,t),e.opts.allowUnionTypes||mk(e,t),gk(e,e.dataTypes))}function hk(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Qy(e.dataTypes,r)||Vu(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),_k(e,t)}}function mk(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Vu(e,"use allowUnionTypes to allow union type keyword")}function gk(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Bu.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>yk(t,i))&&Vu(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function yk(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Qy(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function _k(e,t){let r=[];for(let n of e.dataTypes)Qy(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Vu(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Rt.checkStrictMode)(e,t,e.opts.strictTypes)}var xi=class{constructor(t,r,n){if((0,go.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Rt.schemaRefOrVal)(t,this.schema,n,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",t_(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,go.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",Z.default.errors))}result(t,r,n){this.failResult((0,C.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():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,C.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,C._)`${r} !== undefined && (${(0,C.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?mo.reportExtraError:mo.reportError)(this,this.def.error,r)}$dataError(){(0,mo.reportError)(this,this.def.$dataError||mo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,mo.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,n=C.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=C.nil,r=C.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,C.or)((0,C._)`${o} === undefined`,r)),t!==C.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==C.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,C.or)(i(),a());function i(){if(n.length){if(!(r instanceof C.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,C._)`${(0,wi.checkDataTypes)(c,r,s.opts.strictNumbers,wi.DataType.Wrong)}`}return C.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,C._)`!${c}(${r})`}return C.nil}}subschema(t,r){let n=(0,Fu.getSubschema)(this.it,t);(0,Fu.extendSubschemaData)(n,this.it,t),(0,Fu.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return sk(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Rt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Rt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,C.Name)),!0}};Xt.KeywordCxt=xi;function e_(e,t,r,n){let o=new xi(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,go.funcKeywordCode)(o,r):"macro"in r?(0,go.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,go.funcKeywordCode)(o,r)}var bk=/^\/(?:[^~]|~0|~1)*$/,wk=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function t_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return Z.default.rootData;if(e[0]==="/"){if(!bk.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=Z.default.rootData}else{let u=wk.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,C._)`${s}${(0,C.getProperty)((0,Rt.unescapeJsonPointer)(u))}`,i=(0,C._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Xt.getData=t_});var vi=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var Hu=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Ku.default=Hu});var _o=E(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});var Ju=ho(),Wu=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ju.resolveUrl)(t,r,n),this.missingSchema=(0,Ju.normalizeId)((0,Ju.getFullPath)(t,this.missingRef))}};Gu.default=Wu});var Si=E(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.resolveSchema=Ge.getCompilingSchema=Ge.resolveRef=Ge.compileSchema=Ge.SchemaEnv=void 0;var ot=L(),xk=vi(),gr=Ot(),st=ho(),r_=B(),vk=yo(),an=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=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,st.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Ge.SchemaEnv=an;function Yu(e){let t=n_.call(this,e);if(t)return t;let r=(0,st.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ot.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:xk.default,code:(0,ot._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:gr.default.data,parentData:gr.default.parentData,parentDataProperty:gr.default.parentDataProperty,dataNames:[gr.default.data],dataPathArr:[ot.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ot.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ot.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ot._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,vk.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(gr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${gr.default.self}`,`${gr.default.scope}`,l)(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:h,items:m}=u;f.evaluated={props:h instanceof ot.Name?void 0:h,items:m instanceof ot.Name?void 0:m,dynamicProps:h instanceof ot.Name,dynamicItems:m instanceof ot.Name},f.source&&(f.source.evaluated=(0,ot.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Ge.compileSchema=Yu;function $k(e,t,r){var n;r=(0,st.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=kk.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new an({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Sk.call(this,s)}Ge.resolveRef=$k;function Sk(e){return(0,st.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Yu.call(this,e)}function n_(e){for(let t of this._compilations)if(zk(t,e))return t}Ge.getCompilingSchema=n_;function zk(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function kk(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||$i.call(this,e,t)}function $i(e,t){let r=this.opts.uriResolver.parse(t),n=(0,st._getFullPath)(this.opts.uriResolver,r),o=(0,st.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Xu.call(this,r,e);let s=(0,st.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=$i.call(this,e,i);return typeof a?.schema!="object"?void 0:Xu.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Yu.call(this,i),s===(0,st.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,st.resolveUrl)(this.opts.uriResolver,o,u)),new an({schema:a,schemaId:c,root:e,baseId:o})}return Xu.call(this,r,i)}}Ge.resolveSchema=$i;var Pk=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xu(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,r_.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Pk.has(a)&&u&&(t=(0,st.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,r_.schemaHasRulesButRef)(r,this.RULES)){let a=(0,st.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=$i.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new an({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var o_=E((t4,Ek)=>{Ek.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 ol=E((r4,d_)=>{"use strict";var Tk=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),el=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),Ok=RegExp.prototype.test.bind(/^\d*$/u),yr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),tl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),i_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),rl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Rk=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Le=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Le[t]="%"+e[t>>4]+e[t&15]}function Te(e){return e<2048?Le[192|e>>6]+Le[128|e&63]:e<65536?Le[224|e>>12]+Le[128|e>>6&63]+Le[128|e&63]:Le[240|e>>18]+Le[128|e>>12&63]+Le[128|e>>6&63]+Le[128|e&63]}function Ak(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Ck=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Ik=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Nk=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),jk=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Zk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Nk(e[t])){if(e[t]==="%"&&t+2<e.length&&yr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function s_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]==="0"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function Dk(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(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!el(c))return;s+=2;continue}if(!Ck(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:s_(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return s_(i)}function Qu(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 n=t?e.slice(1,-1):e;if(t&&Ik(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Mk(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!Zk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=Dk(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function Mk(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Lk(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===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(o===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((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Uk={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},qk=/[@/?#:]/g,Fk=/[@/?#]/g;function a_(e,t){let r=t?Fk:qk;return r.lastIndex=0,e.replace(r,n=>Uk[n])}function c_(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(yr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&tl(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function Bk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(yr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&tl(i)?t+=i:t+="%"+s,r+=2;continue}}if(i_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=l_(o)?n:Le[o];else if(o<55296||o>57343)t+=Te(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Te(65536+(o-55296<<10)+(s-56320)),r++):t+=Te(65533)}else t+=Te(65533)}}return t}function Vk(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(yr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),i_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Le[i];else if(i<55296||i>57343)r+=Te(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=Te(65536+(i-55296<<10)+(a-56320)),o++):r+=Te(65533)}else r+=Te(65533)}}return r}function nl(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(yr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Le[s];else if(s<55296||s>57343)r+=Te(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=Te(65536+(s-55296<<10)+(i-56320)),n++):r+=Te(65533)}else r+=Te(65533)}}return r}function u_(e){return nl(e,Rk)}function Hk(e){return nl(e,rl)}function Kk(e){return nl(e,rl)}function l_(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 Jk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(yr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));tl(i)?t+=i:t+="%"+s,r+=2;continue}}if(rl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=l_(o)?n:Le[o];else if(o<55296||o>57343)t+=Te(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Te(65536+(o-55296<<10)+(s-56320)),r++):t+=Te(65533)}else t+=Te(65533)}}return t}function Wk(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(yr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Gk(e){let t=[];if(e.userinfo!==void 0&&(t.push(u_(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!el(r)){let n=Qu(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=c_(r,!0),n=Qu(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=a_(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Ok(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}d_.exports={nonSimpleDomain:jk,recomposeAuthority:Gk,reescapeHostDelimiters:a_,normalizePercentEncoding:c_,normalizePathEncoding:Bk,serializePathEncoding:Vk,normalizeQueryFragmentEncoding:Jk,encodeUserinfo:u_,encodeQuery:Hk,encodeFragment:Kk,escapePreservingEscapes:Wk,removeDotSegments:Lk,isIPv4:el,isUUID:Tk,normalizeIPv6:Qu,stringArrayToHexStripped:Ak}});var g_=E((n4,m_)=>{"use strict";var{isUUID:Xk}=ol(),Yk=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Qk=["http","https","ws","wss","urn","urn:uuid"];function e1(e){return Qk.indexOf(e)!==-1}function sl(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 f_(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function p_(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 t1(e){return e.secure=sl(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function r1(e){if((e.port===(sl(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 n1(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Yk);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=il(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function o1(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=il(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function s1(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Xk(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function i1(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var h_={scheme:"http",domainHost:!0,parse:f_,serialize:p_},a1={scheme:"https",domainHost:h_.domainHost,parse:f_,serialize:p_},zi={scheme:"ws",domainHost:!0,parse:t1,serialize:r1},c1={scheme:"wss",domainHost:zi.domainHost,parse:zi.parse,serialize:zi.serialize},u1={scheme:"urn",parse:n1,serialize:o1,skipNormalize:!0},l1={scheme:"urn:uuid",parse:s1,serialize:i1,skipNormalize:!0},ki={http:h_,https:a1,ws:zi,wss:c1,urn:u1,"urn:uuid":l1};Object.setPrototypeOf(ki,null);function il(e){return e&&(ki[e]||ki[e.toLowerCase()])||void 0}m_.exports={wsIsSecure:sl,SCHEMES:ki,isValidSchemeName:e1,getSchemeHandler:il}});var T_=E((o4,Ti)=>{"use strict";var{normalizeIPv6:x_,removeDotSegments:wo,recomposeAuthority:d1,normalizePercentEncoding:al,normalizePathEncoding:f1,serializePathEncoding:y_,normalizeQueryFragmentEncoding:__,encodeQuery:p1,encodeFragment:h1,reescapeHostDelimiters:m1,isIPv4:v_,nonSimpleDomain:g1}=ol(),{SCHEMES:$_,getSchemeHandler:cl}=g_(),S_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,z_="URI scheme is malformed.";function b_(e){let t=unescape(String(e));if(!S_.test(t))throw new TypeError(z_);return t}function y1(e,t){return typeof e=="string"?e=z1(e,t):typeof e=="object"&&(e=Ei(_r(e,t),t)),e}function _1(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=Pi(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:h,malformedScheme:m}=Pi(t,n);if(s||d||i||p||a||f||c||h||u||m)throw new Error(o.error||l.error||"URI is malformed.");let y=k_(o,l,n,!0),w=cl(r&&r.scheme||y.scheme),v=y.host,S=v!==void 0&&v!==""&&(v_(v)||x_(v).isIPV6);P_(y,r||{},w,S);let T=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(y.error&&!T)throw new Error(y.error);return n.skipEscape=!0,_r(y,n)}function k_(e,t,r,n){let o={};return n||(e=Ei(_r(e,r),r),t=Ei(_r(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=wo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=wo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=wo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=wo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function b1(e,t,r){let n=w_(e,r),o=w_(t,r);return n!==void 0&&o!==void 0&&n===o}function _r(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:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=b_(r.scheme));let s=cl(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=al(r.path):r.path=y_(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=b_(r.scheme),o.push(r.scheme,":"));let c=d1(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(u=wo(u)),a&&(u=y_(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",p1(r.query)),r.fragment!==void 0&&o.push("#",h1(r.fragment)),o.join("")}var w1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,x1=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,v1=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function $1(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 bo(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 ul(e){return e[0]==="["&&e[e.length-1]==="]"}function S1(e){let t=e[4];return bo(e[3])||t!==void 0&&!ul(t)&&bo(t)||bo(e[6])||bo(e[7])||bo(e[8])}function P_(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!ul(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&g1(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function Pi(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(x1);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let p=e.match(v1);if(p!==null){let h=p[1],m=h.replace(/[\t\n\r]/g,"");m.length>=2&&(m.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):h.length!==m.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match(w1);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);S_.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||z_,u=!0)}s=S1(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let h=$1(n,f);if(h!==void 0&&(n.error=n.error||h,o=!0),n.host)if(v_(n.host)===!1){let w=ul(n.host),v=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=x_(n.host);l=S.isIPV6||S.isIPVFuture===!0,c=v&&(!w||S.error===!0),n.host=l?S.host:S.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let m=cl(r.scheme||n.scheme);if(c||(a=P_(n,r,m,l)),e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:al(n.host,!0);l||(y=al(y.toLowerCase())),n.host=m1(y,l)}(!m||m&&!m.skipNormalize)&&(n.path&&(n.path=f1(n.path)),n.query&&(n.query=__(n.query)),n.fragment&&(n.fragment=__(n.fragment))),m&&m.parse&&(m.parse(n,r),m===$_.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function Ei(e,t){return Pi(e,t).parsed}function z1(e,t){return E_(e,t).normalized}function E_(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Pi(e,t);return{normalized:n||o||s||i||a?e:_r(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function w_(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:_r(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=E_(r,t);return o||s||i||a||c?void 0:n}var ll={SCHEMES:$_,normalize:y1,resolve:_1,resolveComponent:k_,equal:b1,serialize:_r,parse:Ei};Ti.exports=ll;Ti.exports.default=ll;Ti.exports.fastUri=ll});var R_=E(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});var O_=T_();O_.code='require("ajv/dist/runtime/uri").default';dl.default=O_});var M_=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.CodeGen=$e.Name=$e.nil=$e.stringify=$e.str=$e._=$e.KeywordCxt=void 0;var k1=yo();Object.defineProperty($e,"KeywordCxt",{enumerable:!0,get:function(){return k1.KeywordCxt}});var cn=L();Object.defineProperty($e,"_",{enumerable:!0,get:function(){return cn._}});Object.defineProperty($e,"str",{enumerable:!0,get:function(){return cn.str}});Object.defineProperty($e,"stringify",{enumerable:!0,get:function(){return cn.stringify}});Object.defineProperty($e,"nil",{enumerable:!0,get:function(){return cn.nil}});Object.defineProperty($e,"Name",{enumerable:!0,get:function(){return cn.Name}});Object.defineProperty($e,"CodeGen",{enumerable:!0,get:function(){return cn.CodeGen}});var P1=vi(),j_=_o(),E1=Cu(),xo=Si(),T1=L(),vo=ho(),Oi=po(),pl=B(),A_=o_(),O1=R_(),Z_=(e,t)=>new RegExp(e,t);Z_.code="new RegExp";var R1=["removeAdditional","useDefaults","coerceTypes"],A1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),C1={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."},I1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},C_=200;function N1(e){var t,r,n,o,s,i,a,c,u,l,d,p,f,h,m,y,w,v,S,T,_,x,$,P,O;let D=e.strict,se=(t=e.code)===null||t===void 0?void 0:t.optimize,ye=se===!0||se===void 0?1:se||0,yt=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Z_,ct=(o=e.uriResolver)!==null&&o!==void 0?o:O1.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:D)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:D)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:D)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:D)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:ye,regExp:yt}:{optimize:ye,regExp:yt},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:C_,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:C_,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(_=e.addUsedSchema)!==null&&_!==void 0?_:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:($=e.validateFormats)!==null&&$!==void 0?$:!0,unicodeRegExp:(P=e.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(O=e.int32range)!==null&&O!==void 0?O:!0,uriResolver:ct}}var $o=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,...N1(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new T1.ValueScope({scope:{},prefixes:A1,es5:r,lines:n}),this.logger=U1(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,E1.getRules)(),I_.call(this,C1,t,"NOT SUPPORTED"),I_.call(this,I1,t,"DEPRECATED","warn"),this._metaOpts=M1.call(this),t.formats&&Z1.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&D1.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),j1.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=A_;n==="id"&&(o={...A_},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!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 n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof j_.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);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,vo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=N_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new xo.SchemaEnv({schema:{},schemaId:n});if(r=xo.resolveSchema.call(this,o,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=N_.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 n=t[this.opts.schemaId];return n&&(n=(0,vo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(F1.call(this,n,r),!r)return(0,pl.eachItem)(n,s=>fl.call(this,s)),this;V1.call(this,r);let o={...r,type:(0,Oi.getJSONTypes)(r.type),schemaType:(0,Oi.getJSONTypes)(r.schemaType)};return(0,pl.eachItem)(n,o.type.length===0?s=>fl.call(this,s,o):s=>o.type.forEach(i=>fl.call(this,s,o,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 n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,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:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=D_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=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;n=(0,vo.normalizeId)(i||n);let u=vo.getSchemaRefs.call(this,t,n);return c=new xo.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&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):xo.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{xo.compileSchema.call(this,t)}finally{this.opts=r}}};$o.ValidationError=P1.default;$o.MissingRefError=j_.default;$e.default=$o;function I_(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function N_(e){return e=(0,vo.normalizeId)(e),this.schemas[e]||this.refs[e]}function j1(){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 Z1(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function D1(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 M1(){let e={...this.opts};for(let t of R1)delete e[t];return e}var L1={log(){},warn(){},error(){}};function U1(e){if(e===!1)return L1;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 q1=/^[a-z_$][a-z0-9_$:-]*$/i;function F1(e,t){let{RULES:r}=this;if((0,pl.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!q1.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function fl(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?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,Oi.getJSONTypes)(t.type),schemaType:(0,Oi.getJSONTypes)(t.schemaType)}};t.before?B1.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function B1(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function V1(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=D_(t)),e.validateSchema=this.compile(t,!0))}var H1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D_(e){return{anyOf:[e,H1]}}});var L_=E(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var K1={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};hl.default=K1});var B_=E(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.callRef=br.getValidate=void 0;var J1=_o(),U_=We(),Ue=L(),un=Ot(),q_=Si(),Ri=B(),W1={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=q_.resolveRef.call(c,u,o,r);if(l===void 0)throw new J1.default(n.opts.uriResolver,o,r);if(l instanceof q_.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Ai(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Ai(e,(0,Ue._)`${h}.validate`,u,u.$async)}function p(h){let m=F_(e,h);Ai(e,m,h,h.$async)}function f(h){let m=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Ue.stringify)(h)}:{ref:h}),y=t.name("valid"),w=e.subschema({schema:h,dataTypes:[],schemaPath:Ue.nil,topSchemaRef:m,errSchemaPath:r},y);e.mergeEvaluated(w),e.ok(y)}}};function F_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ue._)`${r.scopeValue("wrapper",{ref:t})}.validate`}br.getValidate=F_;function Ai(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?un.default.this:Ue.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ue._)`await ${(0,U_.callValidateCode)(e,t,u)}`),f(t),i||o.assign(h,!0)},m=>{o.if((0,Ue._)`!(${m} instanceof ${s.ValidationError})`,()=>o.throw(m)),p(m),i||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,U_.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(h){let m=(0,Ue._)`${h}.errors`;o.assign(un.default.vErrors,(0,Ue._)`${un.default.vErrors} === null ? ${m} : ${un.default.vErrors}.concat(${m})`),o.assign(un.default.errors,(0,Ue._)`${un.default.vErrors}.length`)}function f(h){var m;if(!s.opts.unevaluated)return;let y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=Ri.mergeEvaluated.props(o,y.props,s.props));else{let w=o.var("props",(0,Ue._)`${h}.evaluated.props`);s.props=Ri.mergeEvaluated.props(o,w,s.props,Ue.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=Ri.mergeEvaluated.items(o,y.items,s.items));else{let w=o.var("items",(0,Ue._)`${h}.evaluated.items`);s.items=Ri.mergeEvaluated.items(o,w,s.items,Ue.Name)}}}br.callRef=Ai;br.default=W1});var V_=E(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});var G1=L_(),X1=B_(),Y1=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",G1.default,X1.default];ml.default=Y1});var H_=E(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});var Ci=L(),Yt=Ci.operators,Ii={maximum:{okStr:"<=",ok:Yt.LTE,fail:Yt.GT},minimum:{okStr:">=",ok:Yt.GTE,fail:Yt.LT},exclusiveMaximum:{okStr:"<",ok:Yt.LT,fail:Yt.GTE},exclusiveMinimum:{okStr:">",ok:Yt.GT,fail:Yt.LTE}},Q1={message:({keyword:e,schemaCode:t})=>(0,Ci.str)`must be ${Ii[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ci._)`{comparison: ${Ii[e].okStr}, limit: ${t}}`},eP={keyword:Object.keys(Ii),type:"number",schemaType:"number",$data:!0,error:Q1,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ci._)`${r} ${Ii[t].fail} ${n} || isNaN(${r})`)}};gl.default=eP});var K_=E(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var So=L(),tP={message:({schemaCode:e})=>(0,So.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,So._)`{multipleOf: ${e}}`},rP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:tP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,So._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,So._)`${i} !== parseInt(${i})`;e.fail$data((0,So._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};yl.default=rP});var W_=E(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});function J_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}_l.default=J_;J_.code='require("ajv/dist/runtime/ucs2length").default'});var G_=E(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});var wr=L(),nP=B(),oP=W_(),sP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,wr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,wr._)`{limit: ${e}}`},iP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:sP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?wr.operators.GT:wr.operators.LT,i=o.opts.unicode===!1?(0,wr._)`${r}.length`:(0,wr._)`${(0,nP.useFunc)(e.gen,oP.default)}(${r})`;e.fail$data((0,wr._)`${i} ${s} ${n}`)}};bl.default=iP});var X_=E(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});var aP=We(),cP=B(),ln=L(),uP={message:({schemaCode:e})=>(0,ln.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,ln._)`{pattern: ${e}}`},lP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:uP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,ln._)`new RegExp`:(0,cP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,ln._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,ln._)`!${l}`)}else{let c=(0,aP.usePattern)(e,o);e.fail$data((0,ln._)`!${c}.test(${r})`)}}};wl.default=lP});var Y_=E(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});var zo=L(),dP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,zo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,zo._)`{limit: ${e}}`},fP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:dP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?zo.operators.GT:zo.operators.LT;e.fail$data((0,zo._)`Object.keys(${r}).length ${o} ${n}`)}};xl.default=fP});var Q_=E(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var ko=We(),Po=L(),pP=B(),hP={message:({params:{missingProperty:e}})=>(0,Po.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Po._)`{missingProperty: ${e}}`},mP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:hP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if(f?.[m]===void 0&&!h.has(m)){let y=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,pP.checkStrictMode)(i,w,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Po.nil,d);else for(let f of r)(0,ko.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>p(f,h)),e.ok(h)}else t.if((0,ko.checkMissingProp)(e,r,f)),(0,ko.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,ko.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function p(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,(0,ko.propertyInData)(t,o,f,a.ownProperties)),t.if((0,Po.not)(h),()=>{e.error(),t.break()})},Po.nil)}}};vl.default=mP});var e0=E($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});var Eo=L(),gP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Eo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Eo._)`{limit: ${e}}`},yP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:gP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Eo.operators.GT:Eo.operators.LT;e.fail$data((0,Eo._)`${r}.length ${o} ${n}`)}};$l.default=yP});var Ni=E(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var t0=Uu();t0.code='require("ajv/dist/runtime/equal").default';Sl.default=t0});var r0=E(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});var zl=po(),Se=L(),_P=B(),bP=Ni(),wP={message:({params:{i:e,j:t}})=>(0,Se.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Se._)`{i: ${e}, j: ${t}}`},xP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:wP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,zl.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,Se._)`${i} === false`),e.ok(c);function l(){let h=t.let("i",(0,Se._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(c,!0),t.if((0,Se._)`${h} > 1`,()=>(d()?p:f)(h,m))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,m){let y=t.name("item"),w=(0,zl.checkDataTypes)(u,y,a.opts.strictNumbers,zl.DataType.Wrong),v=t.const("indices",(0,Se._)`{}`);t.for((0,Se._)`;${h}--;`,()=>{t.let(y,(0,Se._)`${r}[${h}]`),t.if(w,(0,Se._)`continue`),u.length>1&&t.if((0,Se._)`typeof ${y} == "string"`,(0,Se._)`${y} += "_"`),t.if((0,Se._)`typeof ${v}[${y}] == "number"`,()=>{t.assign(m,(0,Se._)`${v}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Se._)`${v}[${y}] = ${h}`)})}function f(h,m){let y=(0,_P.useFunc)(t,bP.default),w=t.name("outer");t.label(w).for((0,Se._)`;${h}--;`,()=>t.for((0,Se._)`${m} = ${h}; ${m}--;`,()=>t.if((0,Se._)`${y}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};kl.default=xP});var n0=E(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});var Pl=L(),vP=B(),$P=Ni(),SP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Pl._)`{allowedValue: ${e}}`},zP={keyword:"const",$data:!0,error:SP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Pl._)`!${(0,vP.useFunc)(t,$P.default)}(${r}, ${o})`):e.fail((0,Pl._)`${s} !== ${r}`)}};El.default=zP});var o0=E(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});var To=L(),kP=B(),PP=Ni(),EP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,To._)`{allowedValues: ${e}}`},TP={keyword:"enum",schemaType:"array",$data:!0,error:EP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,kP.useFunc)(t,PP.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,To.or)(...o.map((h,m)=>p(f,m)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,To._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,h){let m=o[h];return typeof m=="object"&&m!==null?(0,To._)`${u()}(${r}, ${f}[${h}])`:(0,To._)`${r} === ${m}`}}};Tl.default=TP});var s0=E(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});var OP=H_(),RP=K_(),AP=G_(),CP=X_(),IP=Y_(),NP=Q_(),jP=e0(),ZP=r0(),DP=n0(),MP=o0(),LP=[OP.default,RP.default,AP.default,CP.default,IP.default,NP.default,jP.default,ZP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},DP.default,MP.default];Ol.default=LP});var Al=E(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.validateAdditionalItems=void 0;var xr=L(),Rl=B(),UP={message:({params:{len:e}})=>(0,xr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,xr._)`{limit: ${e}}`},qP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:UP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Rl.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}i0(e,n)}};function i0(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,xr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,xr._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Rl.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,xr._)`${a} <= ${t.length}`);r.if((0,xr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:Rl.Type.Num},u),i.allErrors||r.if((0,xr.not)(u),()=>r.break())})}}Oo.validateAdditionalItems=i0;Oo.default=qP});var Cl=E(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.validateTuple=void 0;var a0=L(),ji=B(),FP=We(),BP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return c0(e,"additionalItems",t);r.items=!0,!(0,ji.alwaysValidSchema)(r,t)&&e.ok((0,FP.validateArray)(e))}};function c0(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ji.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,a0._)`${s}.length`);r.forEach((d,p)=>{(0,ji.alwaysValidSchema)(a,d)||(n.if((0,a0._)`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,m=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!m){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,ji.checkStrictMode)(a,y,p.strictTuples)}}}Ro.validateTuple=c0;Ro.default=BP});var u0=E(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});var VP=Cl(),HP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,VP.validateTuple)(e,"items")};Il.default=HP});var d0=E(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});var l0=L(),KP=B(),JP=We(),WP=Al(),GP={message:({params:{len:e}})=>(0,l0.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,l0._)`{limit: ${e}}`},XP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:GP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,KP.alwaysValidSchema)(n,t)&&(o?(0,WP.validateAdditionalItems)(e,o):e.ok((0,JP.validateArray)(e)))}};Nl.default=XP});var f0=E(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var Xe=L(),Zi=B(),YP={message:({params:{min:e,max:t}})=>t===void 0?(0,Xe.str)`must contain at least ${e} valid item(s)`:(0,Xe.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Xe._)`{minContains: ${e}}`:(0,Xe._)`{minContains: ${e}, maxContains: ${t}}`},QP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YP,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Xe._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Zi.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Zi.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Zi.alwaysValidSchema)(s,r)){let m=(0,Xe._)`${l} >= ${i}`;a!==void 0&&(m=(0,Xe._)`${m} && ${l} <= ${a}`),e.pass(m);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,Xe._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let m=t.name("_valid"),y=t.let("count",0);f(m,()=>t.if(m,()=>h(y)))}function f(m,y){t.forRange("i",0,l,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Zi.Type.Num,compositeRule:!0},m),y()})}function h(m){t.code((0,Xe._)`${m}++`),a===void 0?t.if((0,Xe._)`${m} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,Xe._)`${m} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,Xe._)`${m} >= ${i}`,()=>t.assign(d,!0)))}}};jl.default=QP});var m0=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.validateSchemaDeps=ht.validatePropertyDeps=ht.error=void 0;var Zl=L(),eE=B(),Ao=We();ht.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Zl.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Zl._)`{property: ${e},
|
|
3
|
+
var Lb=Object.create;var ca=Object.defineProperty;var Ub=Object.getOwnPropertyDescriptor;var qb=Object.getOwnPropertyNames;var Fb=Object.getPrototypeOf,Bb=Object.prototype.hasOwnProperty;var P=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ua=(e,t)=>{for(var r in t)ca(e,r,{get:t[r],enumerable:!0})},Vb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qb(t))!Bb.call(e,o)&&o!==r&&ca(e,o,{get:()=>t[o],enumerable:!(n=Ub(t,o))||n.enumerable});return e};var la=(e,t,r)=>(r=e!=null?Lb(Fb(e)):{},Vb(t||!e||!e.__esModule?ca(r,"default",{value:e,enumerable:!0}):r,e));var ao=P(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.regexpCode=Y.getEsmExportName=Y.getProperty=Y.safeStringify=Y.stringify=Y.strConcat=Y.addCodeArg=Y.str=Y._=Y.nil=Y._Code=Y.Name=Y.IDENTIFIER=Y._CodeOrName=void 0;var so=class{};Y._CodeOrName=so;Y.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var dr=class extends so{constructor(t){if(super(),!Y.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}}};Y.Name=dr;var Ye=class extends so{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,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof dr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Y._Code=Ye;Y.nil=new Ye("");function uy(e,...t){let r=[e[0]],n=0;for(;n<t.length;)hu(r,t[n]),r.push(e[++n]);return new Ye(r)}Y._=uy;var pu=new Ye("+");function ly(e,...t){let r=[io(e[0])],n=0;for(;n<t.length;)r.push(pu),hu(r,t[n]),r.push(pu,io(e[++n]));return wS(r),new Ye(r)}Y.str=ly;function hu(e,t){t instanceof Ye?e.push(...t._items):t instanceof dr?e.push(t):e.push($S(t))}Y.addCodeArg=hu;function wS(e){let t=1;for(;t<e.length-1;){if(e[t]===pu){let r=xS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function xS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof dr||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 dr))return`"${e}${t.slice(1)}`}function vS(e,t){return t.emptyStr()?e:e.emptyStr()?t:ly`${e}${t}`}Y.strConcat=vS;function $S(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:io(Array.isArray(e)?e.join(","):e)}function SS(e){return new Ye(io(e))}Y.stringify=SS;function io(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Y.safeStringify=io;function zS(e){return typeof e=="string"&&Y.IDENTIFIER.test(e)?new Ye(`.${e}`):uy`[${e}]`}Y.getProperty=zS;function kS(e){if(typeof e=="string"&&Y.IDENTIFIER.test(e))return new Ye(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Y.getEsmExportName=kS;function PS(e){return new Ye(e.toString())}Y.regexpCode=PS});var yu=P(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.ValueScope=Ue.ValueScopeName=Ue.Scope=Ue.varKinds=Ue.UsedValueState=void 0;var Le=ao(),mu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},pi;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(pi||(Ue.UsedValueState=pi={}));Ue.varKinds={const:new Le.Name("const"),let:new Le.Name("let"),var:new Le.Name("var")};var hi=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Le.Name?t:this.name(t)}name(t){return new Le.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};Ue.Scope=hi;var mi=class extends Le.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Le._)`.${new Le.Name(r)}[${n}]`}};Ue.ValueScopeName=mi;var ES=(0,Le._)`\n`,gu=class extends hi{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?ES:Le.nil}}get(){return this._scope}name(t){return new mi(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Le._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=Le.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,pi.Started);let l=r(u);if(l){let d=this.opts.es5?Ue.varKinds.var:Ue.varKinds.const;s=(0,Le._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Le._)`${s}${l}${this.opts._n}`;else throw new mu(u);c.set(u,pi.Completed)})}return s}};Ue.ValueScope=gu});var U=P(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.or=q.and=q.not=q.CodeGen=q.operators=q.varKinds=q.ValueScopeName=q.ValueScope=q.Scope=q.Name=q.regexpCode=q.stringify=q.getProperty=q.nil=q.strConcat=q.str=q._=void 0;var H=ao(),at=yu(),Kt=ao();Object.defineProperty(q,"_",{enumerable:!0,get:function(){return Kt._}});Object.defineProperty(q,"str",{enumerable:!0,get:function(){return Kt.str}});Object.defineProperty(q,"strConcat",{enumerable:!0,get:function(){return Kt.strConcat}});Object.defineProperty(q,"nil",{enumerable:!0,get:function(){return Kt.nil}});Object.defineProperty(q,"getProperty",{enumerable:!0,get:function(){return Kt.getProperty}});Object.defineProperty(q,"stringify",{enumerable:!0,get:function(){return Kt.stringify}});Object.defineProperty(q,"regexpCode",{enumerable:!0,get:function(){return Kt.regexpCode}});Object.defineProperty(q,"Name",{enumerable:!0,get:function(){return Kt.Name}});var bi=yu();Object.defineProperty(q,"Scope",{enumerable:!0,get:function(){return bi.Scope}});Object.defineProperty(q,"ValueScope",{enumerable:!0,get:function(){return bi.ValueScope}});Object.defineProperty(q,"ValueScopeName",{enumerable:!0,get:function(){return bi.ValueScopeName}});Object.defineProperty(q,"varKinds",{enumerable:!0,get:function(){return bi.varKinds}});q.operators={GT:new H._Code(">"),GTE:new H._Code(">="),LT:new H._Code("<"),LTE:new H._Code("<="),EQ:new H._Code("==="),NEQ:new H._Code("!=="),NOT:new H._Code("!"),OR:new H._Code("||"),AND:new H._Code("&&"),ADD:new H._Code("+")};var Tt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},_u=class extends Tt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?at.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=rn(this.rhs,t,r)),this}get names(){return this.rhs instanceof H._CodeOrName?this.rhs.names:{}}},gi=class extends Tt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof H.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=rn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof H.Name?{}:{...this.lhs.names};return _i(t,this.rhs)}},bu=class extends gi{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},wu=class extends Tt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},xu=class extends Tt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},vu=class extends Tt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},$u=class extends Tt{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=rn(this.code,t,r),this}get names(){return this.code instanceof H._CodeOrName?this.code.names:{}}},co=class extends Tt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(TS(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>hr(t,r.names),{})}},Ot=class extends co{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Su=class extends co{},tn=class extends Ot{};tn.kind="else";var fr=class e extends Ot{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 n=r.optimizeNodes();r=this.else=Array.isArray(n)?new tn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(dy(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=rn(this.condition,t,r),this}get names(){let t=super.names;return _i(t,this.condition),this.else&&hr(t,this.else.names),t}};fr.kind="if";var pr=class extends Ot{};pr.kind="for";var zu=class extends pr{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=rn(this.iteration,t,r),this}get names(){return hr(super.names,this.iteration.names)}},ku=class extends pr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?at.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=_i(super.names,this.from);return _i(t,this.to)}},yi=class extends pr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}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=rn(this.iterable,t,r),this}get names(){return hr(super.names,this.iterable.names)}},uo=class extends Ot{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};uo.kind="func";var lo=class extends co{render(t){return"return "+super.render(t)}};lo.kind="return";var Pu=class extends Ot{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 n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&hr(t,this.catch.names),this.finally&&hr(t,this.finally.names),t}},fo=class extends Ot{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};fo.kind="catch";var po=class extends Ot{render(t){return"finally"+super.render(t)}};po.kind="finally";var Eu=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
+
`:""},this._extScope=t,this._scope=new at.Scope({parent:t}),this._nodes=[new Su]}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 n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new _u(t,s,n)),s}const(t,r,n){return this._def(at.varKinds.const,t,r,n)}let(t,r,n){return this._def(at.varKinds.let,t,r,n)}var(t,r,n){return this._def(at.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new gi(t,r,n))}add(t,r){return this._leafNode(new bu(t,q.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==H.nil&&this._leafNode(new $u(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,H.addCodeArg)(r,o));return r.push("}"),new H._Code(r)}if(t,r,n){if(this._blockNode(new fr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new fr(t))}else(){return this._elseNode(new tn)}endIf(){return this._endBlockNode(fr,tn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new zu(t),r)}forRange(t,r,n,o,s=this.opts.es5?at.varKinds.var:at.varKinds.let){let i=this._scope.toName(t);return this._for(new ku(s,i,r,n),()=>o(i))}forOf(t,r,n,o=at.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof H.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,H._)`${i}.length`,a=>{this.var(s,(0,H._)`${i}[${a}]`),n(s)})}return this._for(new yi("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?at.varKinds.var:at.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,H._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new yi("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(pr)}label(t){return this._leafNode(new wu(t))}break(t){return this._leafNode(new xu(t))}return(t){let r=new lo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(lo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Pu;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new fo(s),r(s)}return n&&(this._currNode=o.finally=new po,this.code(n)),this._endBlockNode(fo,po)}throw(t){return this._leafNode(new vu(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 n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=H.nil,n,o){return this._blockNode(new uo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(uo)}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 n=this._currNode;if(n instanceof t||r&&n 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 fr))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}};q.CodeGen=Eu;function hr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function _i(e,t){return t instanceof H._CodeOrName?hr(e,t.names):e}function rn(e,t,r){if(e instanceof H.Name)return n(e);if(!o(e))return e;return new H._Code(e._items.reduce((s,i)=>(i instanceof H.Name&&(i=n(i)),i instanceof H._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof H._Code&&s._items.some(i=>i instanceof H.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function TS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function dy(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,H._)`!${Tu(e)}`}q.not=dy;var OS=fy(q.operators.AND);function RS(...e){return e.reduce(OS)}q.and=RS;var AS=fy(q.operators.OR);function CS(...e){return e.reduce(AS)}q.or=CS;function fy(e){return(t,r)=>t===H.nil?r:r===H.nil?t:(0,H._)`${Tu(t)} ${e} ${Tu(r)}`}function Tu(e){return e instanceof H.Name?e:(0,H._)`(${e})`}});var K=P(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var ne=U(),IS=ao();function NS(e){let t={};for(let r of e)t[r]=!0;return t}B.toHash=NS;function jS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(my(e,t),!gy(t,e.self.RULES.all))}B.alwaysValidSchema=jS;function my(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||by(e,`unknown keyword: "${s}"`)}B.checkUnknownRules=my;function gy(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}B.schemaHasRules=gy;function ZS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}B.schemaHasRulesButRef=ZS;function DS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ne._)`${r}`}return(0,ne._)`${e}${t}${(0,ne.getProperty)(n)}`}B.schemaRefOrVal=DS;function MS(e){return yy(decodeURIComponent(e))}B.unescapeFragment=MS;function LS(e){return encodeURIComponent(Ru(e))}B.escapeFragment=LS;function Ru(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=Ru;function yy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=yy;function US(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}B.eachItem=US;function py({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof ne.Name?(s instanceof ne.Name?e(o,s,i):t(o,s,i),i):s instanceof ne.Name?(t(o,i,s),s):r(s,i);return a===ne.Name&&!(c instanceof ne.Name)?n(o,c):c}}B.mergeEvaluated={props:py({mergeNames:(e,t,r)=>e.if((0,ne._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,ne._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ne._)`${r} || {}`).code((0,ne._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,ne._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,ne._)`${r} || {}`),Au(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:_y}),items:py({mergeNames:(e,t,r)=>e.if((0,ne._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,ne._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,ne._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,ne._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function _y(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,ne._)`{}`);return t!==void 0&&Au(e,r,t),r}B.evaluatedPropsToName=_y;function Au(e,t,r){Object.keys(r).forEach(n=>e.assign((0,ne._)`${t}${(0,ne.getProperty)(n)}`,!0))}B.setEvaluated=Au;var hy={};function qS(e,t){return e.scopeValue("func",{ref:t,code:hy[t.code]||(hy[t.code]=new IS._Code(t.code))})}B.useFunc=qS;var Ou;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ou||(B.Type=Ou={}));function FS(e,t,r){if(e instanceof ne.Name){let n=t===Ou.Num;return r?n?(0,ne._)`"[" + ${e} + "]"`:(0,ne._)`"['" + ${e} + "']"`:n?(0,ne._)`"/" + ${e}`:(0,ne._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ne.getProperty)(e).toString():"/"+Ru(e)}B.getErrorPath=FS;function by(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}B.checkStrictMode=by});var Rt=P(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});var Te=U(),BS={data:new Te.Name("data"),valCxt:new Te.Name("valCxt"),instancePath:new Te.Name("instancePath"),parentData:new Te.Name("parentData"),parentDataProperty:new Te.Name("parentDataProperty"),rootData:new Te.Name("rootData"),dynamicAnchors:new Te.Name("dynamicAnchors"),vErrors:new Te.Name("vErrors"),errors:new Te.Name("errors"),this:new Te.Name("this"),self:new Te.Name("self"),scope:new Te.Name("scope"),json:new Te.Name("json"),jsonPos:new Te.Name("jsonPos"),jsonLen:new Te.Name("jsonLen"),jsonPart:new Te.Name("jsonPart")};Cu.default=BS});var ho=P(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.extendErrors=Oe.resetErrorsCount=Oe.reportExtraError=Oe.reportError=Oe.keyword$DataError=Oe.keywordError=void 0;var J=U(),wi=K(),Ne=Rt();Oe.keywordError={message:({keyword:e})=>(0,J.str)`must pass "${e}" keyword validation`};Oe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,J.str)`"${e}" keyword must be ${t} ($data)`:(0,J.str)`"${e}" keyword is invalid ($data)`};function VS(e,t=Oe.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=vy(e,t,r);n??(i||a)?wy(s,c):xy(o,(0,J._)`[${c}]`)}Oe.reportError=VS;function HS(e,t=Oe.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=vy(e,t,r);wy(o,a),s||i||xy(n,Ne.default.vErrors)}Oe.reportExtraError=HS;function KS(e,t){e.assign(Ne.default.errors,t),e.if((0,J._)`${Ne.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,J._)`${Ne.default.vErrors}.length`,t),()=>e.assign(Ne.default.vErrors,null)))}Oe.resetErrorsCount=KS;function JS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Ne.default.errors,a=>{e.const(i,(0,J._)`${Ne.default.vErrors}[${a}]`),e.if((0,J._)`${i}.instancePath === undefined`,()=>e.assign((0,J._)`${i}.instancePath`,(0,J.strConcat)(Ne.default.instancePath,s.errorPath))),e.assign((0,J._)`${i}.schemaPath`,(0,J.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,J._)`${i}.schema`,r),e.assign((0,J._)`${i}.data`,n))})}Oe.extendErrors=JS;function wy(e,t){let r=e.const("err",t);e.if((0,J._)`${Ne.default.vErrors} === null`,()=>e.assign(Ne.default.vErrors,(0,J._)`[${r}]`),(0,J._)`${Ne.default.vErrors}.push(${r})`),e.code((0,J._)`${Ne.default.errors}++`)}function xy(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,J._)`new ${e.ValidationError}(${t})`):(r.assign((0,J._)`${n}.errors`,t),r.return(!1))}var mr={keyword:new J.Name("keyword"),schemaPath:new J.Name("schemaPath"),params:new J.Name("params"),propertyName:new J.Name("propertyName"),message:new J.Name("message"),schema:new J.Name("schema"),parentSchema:new J.Name("parentSchema")};function vy(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,J._)`{}`:WS(e,t,r)}function WS(e,t,r={}){let{gen:n,it:o}=e,s=[GS(o,r),XS(e,r)];return YS(e,t,s),n.object(...s)}function GS({errorPath:e},{instancePath:t}){let r=t?(0,J.str)`${e}${(0,wi.getErrorPath)(t,wi.Type.Str)}`:e;return[Ne.default.instancePath,(0,J.strConcat)(Ne.default.instancePath,r)]}function XS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,J.str)`${t}/${e}`;return r&&(o=(0,J.str)`${o}${(0,wi.getErrorPath)(r,wi.Type.Str)}`),[mr.schemaPath,o]}function YS(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([mr.keyword,o],[mr.params,typeof t=="function"?t(e):t||(0,J._)`{}`]),c.messages&&n.push([mr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([mr.schema,i],[mr.parentSchema,(0,J._)`${l}${d}`],[Ne.default.data,s]),u&&n.push([mr.propertyName,u])}});var Sy=P(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.boolOrEmptySchema=nn.topBoolOrEmptySchema=void 0;var QS=ho(),ez=U(),tz=Rt(),rz={message:"boolean schema is false"};function nz(e){let{gen:t,schema:r,validateName:n}=e;r===!1?$y(e,!1):typeof r=="object"&&r.$async===!0?t.return(tz.default.data):(t.assign((0,ez._)`${n}.errors`,null),t.return(!0))}nn.topBoolOrEmptySchema=nz;function oz(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),$y(e)):r.var(t,!0)}nn.boolOrEmptySchema=oz;function $y(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,QS.reportError)(o,rz,void 0,t)}});var Iu=P(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.getRules=on.isJSONType=void 0;var sz=["string","number","integer","boolean","null","object","array"],iz=new Set(sz);function az(e){return typeof e=="string"&&iz.has(e)}on.isJSONType=az;function cz(){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:{}}}on.getRules=cz});var Nu=P(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.shouldUseRule=Jt.shouldUseGroup=Jt.schemaHasRulesForType=void 0;function uz({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&zy(e,n)}Jt.schemaHasRulesForType=uz;function zy(e,t){return t.rules.some(r=>ky(e,r))}Jt.shouldUseGroup=zy;function ky(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Jt.shouldUseRule=ky});var mo=P(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var lz=Iu(),dz=Nu(),fz=ho(),L=U(),Py=K(),sn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(sn||(Re.DataType=sn={}));function pz(e){let t=Ey(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}Re.getSchemaTypes=pz;function Ey(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(lz.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Re.getJSONTypes=Ey;function hz(e,t){let{gen:r,data:n,opts:o}=e,s=mz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,dz.schemaHasRulesForType)(e,t[0]));if(i){let a=Zu(t,n,o.strictNumbers,sn.Wrong);r.if(a,()=>{s.length?gz(e,t,s):Du(e)})}return i}Re.coerceAndCheckDataType=hz;var Ty=new Set(["string","number","integer","boolean","null"]);function mz(e,t){return t?e.filter(r=>Ty.has(r)||t==="array"&&r==="array"):[]}function gz(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,L._)`typeof ${o}`),a=n.let("coerced",(0,L._)`undefined`);s.coerceTypes==="array"&&n.if((0,L._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,L._)`${o}[0]`).assign(i,(0,L._)`typeof ${o}`).if(Zu(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,L._)`${a} !== undefined`);for(let u of r)(Ty.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Du(e),n.endIf(),n.if((0,L._)`${a} !== undefined`,()=>{n.assign(o,a),yz(e,a)});function c(u){switch(u){case"string":n.elseIf((0,L._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,L._)`"" + ${o}`).elseIf((0,L._)`${o} === null`).assign(a,(0,L._)`""`);return;case"number":n.elseIf((0,L._)`${i} == "boolean" || ${o} === null
|
|
5
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,L._)`+${o}`);return;case"integer":n.elseIf((0,L._)`${i} === "boolean" || ${o} === null
|
|
6
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,L._)`+${o}`);return;case"boolean":n.elseIf((0,L._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,L._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,L._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,L._)`${i} === "string" || ${i} === "number"
|
|
7
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,L._)`[${o}]`)}}}function yz({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,L._)`${t} !== undefined`,()=>e.assign((0,L._)`${t}[${r}]`,n))}function ju(e,t,r,n=sn.Correct){let o=n===sn.Correct?L.operators.EQ:L.operators.NEQ,s;switch(e){case"null":return(0,L._)`${t} ${o} null`;case"array":s=(0,L._)`Array.isArray(${t})`;break;case"object":s=(0,L._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,L._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,L._)`typeof ${t} ${o} ${e}`}return n===sn.Correct?s:(0,L.not)(s);function i(a=L.nil){return(0,L.and)((0,L._)`typeof ${t} == "number"`,a,r?(0,L._)`isFinite(${t})`:L.nil)}}Re.checkDataType=ju;function Zu(e,t,r,n){if(e.length===1)return ju(e[0],t,r,n);let o,s=(0,Py.toHash)(e);if(s.array&&s.object){let i=(0,L._)`typeof ${t} != "object"`;o=s.null?i:(0,L._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=L.nil;s.number&&delete s.integer;for(let i in s)o=(0,L.and)(o,ju(i,t,r,n));return o}Re.checkDataTypes=Zu;var _z={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,L._)`{type: ${e}}`:(0,L._)`{type: ${t}}`};function Du(e){let t=bz(e);(0,fz.reportError)(t,_z)}Re.reportTypeError=Du;function bz(e){let{gen:t,data:r,schema:n}=e,o=(0,Py.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Ry=P(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.assignDefaults=void 0;var an=U(),wz=K();function xz(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Oy(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Oy(e,s,o.default))}xi.assignDefaults=xz;function Oy(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,an._)`${s}${(0,an.getProperty)(t)}`;if(o){(0,wz.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,an._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,an._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,an._)`${a} = ${(0,an.stringify)(r)}`)}});var Qe=P(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.validateUnion=ee.validateArray=ee.usePattern=ee.callValidateCode=ee.schemaProperties=ee.allSchemaProperties=ee.noPropertyInData=ee.propertyInData=ee.isOwnProperty=ee.hasPropFunc=ee.reportMissingProp=ee.checkMissingProp=ee.checkReportMissingProp=void 0;var ae=U(),Mu=K(),Wt=Rt(),vz=K();function $z(e,t){let{gen:r,data:n,it:o}=e;r.if(Uu(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ae._)`${t}`},!0),e.error()})}ee.checkReportMissingProp=$z;function Sz({gen:e,data:t,it:{opts:r}},n,o){return(0,ae.or)(...n.map(s=>(0,ae.and)(Uu(e,t,s,r.ownProperties),(0,ae._)`${o} = ${s}`)))}ee.checkMissingProp=Sz;function zz(e,t){e.setParams({missingProperty:t},!0),e.error()}ee.reportMissingProp=zz;function Ay(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ae._)`Object.prototype.hasOwnProperty`})}ee.hasPropFunc=Ay;function Lu(e,t,r){return(0,ae._)`${Ay(e)}.call(${t}, ${r})`}ee.isOwnProperty=Lu;function kz(e,t,r,n){let o=(0,ae._)`${t}${(0,ae.getProperty)(r)} !== undefined`;return n?(0,ae._)`${o} && ${Lu(e,t,r)}`:o}ee.propertyInData=kz;function Uu(e,t,r,n){let o=(0,ae._)`${t}${(0,ae.getProperty)(r)} === undefined`;return n?(0,ae.or)(o,(0,ae.not)(Lu(e,t,r))):o}ee.noPropertyInData=Uu;function Cy(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ee.allSchemaProperties=Cy;function Pz(e,t){return Cy(t).filter(r=>!(0,Mu.alwaysValidSchema)(e,t[r]))}ee.schemaProperties=Pz;function Ez({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,ae._)`${e}, ${t}, ${n}${o}`:t,d=[[Wt.default.instancePath,(0,ae.strConcat)(Wt.default.instancePath,s)],[Wt.default.parentData,i.parentData],[Wt.default.parentDataProperty,i.parentDataProperty],[Wt.default.rootData,Wt.default.rootData]];i.opts.dynamicRef&&d.push([Wt.default.dynamicAnchors,Wt.default.dynamicAnchors]);let p=(0,ae._)`${l}, ${r.object(...d)}`;return c!==ae.nil?(0,ae._)`${a}.call(${c}, ${p})`:(0,ae._)`${a}(${p})`}ee.callValidateCode=Ez;var Tz=(0,ae._)`new RegExp`;function Oz({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ae._)`${o.code==="new RegExp"?Tz:(0,vz.useFunc)(e,o)}(${r}, ${n})`})}ee.usePattern=Oz;function Rz(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.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,ae._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Mu.Type.Num},s),t.if((0,ae.not)(s),a)})}}ee.validateArray=Rz;function Az(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Mu.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ae._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ae.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}ee.validateUnion=Az});var jy=P(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.validateKeywordUsage=ht.validSchemaType=ht.funcKeywordCode=ht.macroKeywordCode=void 0;var je=U(),gr=Rt(),Cz=Qe(),Iz=ho();function Nz(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Ny(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:je.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}ht.macroKeywordCode=Nz;function jz(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Dz(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Ny(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)m(),t.modifying&&Iy(e),y(()=>e.error());else{let _=t.async?f():h();t.modifying&&Iy(e),y(()=>Zz(e,_))}}function f(){let _=n.let("ruleErrs",null);return n.try(()=>m((0,je._)`await `),v=>n.assign(d,!1).if((0,je._)`${v} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,je._)`${v}.errors`),()=>n.throw(v))),_}function h(){let _=(0,je._)`${l}.errors`;return n.assign(_,null),m(je.nil),_}function m(_=t.async?(0,je._)`await `:je.nil){let v=c.opts.passContext?gr.default.this:gr.default.self,$=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,je._)`${_}${(0,Cz.callValidateCode)(e,l,v,$)}`,t.modifying)}function y(_){var v;n.if((0,je.not)((v=t.valid)!==null&&v!==void 0?v:d),_)}}ht.funcKeywordCode=jz;function Iy(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,je._)`${n.parentData}[${n.parentDataProperty}]`))}function Zz(e,t){let{gen:r}=e;r.if((0,je._)`Array.isArray(${t})`,()=>{r.assign(gr.default.vErrors,(0,je._)`${gr.default.vErrors} === null ? ${t} : ${gr.default.vErrors}.concat(${t})`).assign(gr.default.errors,(0,je._)`${gr.default.vErrors}.length`),(0,Iz.extendErrors)(e)},()=>e.error())}function Dz({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ny(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,je.stringify)(r)})}function Mz(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}ht.validSchemaType=Mz;function Lz({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}ht.validateKeywordUsage=Lz});var Dy=P(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.extendSubschemaMode=Gt.extendSubschemaData=Gt.getSubschema=void 0;var mt=U(),Zy=K();function Uz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==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,mt._)`${e.schemaPath}${(0,mt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,mt._)`${e.schemaPath}${(0,mt.getProperty)(t)}${(0,mt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Zy.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Gt.getSubschema=Uz;function qz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==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:u,dataPathArr:l,opts:d}=t,p=a.let("data",(0,mt._)`${t.data}${(0,mt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,mt.str)`${u}${(0,Zy.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,mt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof mt.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Gt.extendSubschemaData=qz;function Fz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Gt.extendSubschemaMode=Fz});var qu=P((Xj,My)=>{"use strict";My.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 n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))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),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Uy=P((Yj,Ly)=>{"use strict";var Xt=Ly.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};vi(t,n,o,e,"",e)};Xt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Xt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Xt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Xt.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 vi(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Xt.arrayKeywords)for(var p=0;p<d.length;p++)vi(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in Xt.propsKeywords){if(d&&typeof d=="object")for(var f in d)vi(e,t,r,d[f],o+"/"+l+"/"+Bz(f),s,o,l,n,f)}else(l in Xt.keywords||e.allKeys&&!(l in Xt.skipKeywords))&&vi(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Bz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var go=P(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.getSchemaRefs=qe.resolveUrl=qe.normalizeId=qe._getFullPath=qe.getFullPath=qe.inlineRef=void 0;var Vz=K(),Hz=qu(),Kz=Uy(),Jz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Wz(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Fu(e):t?qy(e)<=t:!1}qe.inlineRef=Wz;var Gz=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Fu(e){for(let t in e){if(Gz.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Fu)||typeof r=="object"&&Fu(r))return!0}return!1}function qy(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Jz.has(r)&&(typeof e[r]=="object"&&(0,Vz.eachItem)(e[r],n=>t+=qy(n)),t===1/0))return 1/0}return t}function Fy(e,t="",r){r!==!1&&(t=cn(t));let n=e.parse(t);return By(e,n)}qe.getFullPath=Fy;function By(e,t){return e.serialize(t).split("#")[0]+"#"}qe._getFullPath=By;var Xz=/#\/?$/;function cn(e){return e?e.replace(Xz,""):""}qe.normalizeId=cn;function Yz(e,t,r){return r=cn(r),e.resolve(t,r)}qe.resolveUrl=Yz;var Qz=/^[a-z_][-a-z0-9._]*$/i;function ek(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=cn(e[r]||t),s={"":o},i=Fy(n,o,!1),a={},c=new Set;return Kz(e,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let m=i+p,y=s[h];typeof d[r]=="string"&&(y=_.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),s[p]=y;function _($){let C=this.opts.uriResolver.resolve;if($=cn(y?C(y,$):$),c.has($))throw l($);c.add($);let w=this.refs[$];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(d,w.schema,$):$!==cn(m)&&($[0]==="#"?(u(d,a[$],$),a[$]=d):this.refs[$]=m),$}function v($){if(typeof $=="string"){if(!Qz.test($))throw new Error(`invalid anchor "${$}"`);_.call(this,`#${$}`)}}}),a;function u(d,p,f){if(p!==void 0&&!Hz(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}qe.getSchemaRefs=ek});var bo=P(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getData=Yt.KeywordCxt=Yt.validateFunctionCode=void 0;var Wy=Sy(),Vy=mo(),Vu=Nu(),$i=mo(),tk=Ry(),_o=jy(),Bu=Dy(),A=U(),Z=Rt(),rk=go(),At=K(),yo=ho();function nk(e){if(Yy(e)&&(Qy(e),Xy(e))){ik(e);return}Gy(e,()=>(0,Wy.topBoolOrEmptySchema)(e))}Yt.validateFunctionCode=nk;function Gy({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,A._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{e.code((0,A._)`"use strict"; ${Hy(r,o)}`),sk(e,o),e.code(s)}):e.func(t,(0,A._)`${Z.default.data}, ${ok(o)}`,n.$async,()=>e.code(Hy(r,o)).code(s))}function ok(e){return(0,A._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${e.dynamicRef?(0,A._)`, ${Z.default.dynamicAnchors}={}`:A.nil}}={}`}function sk(e,t){e.if(Z.default.valCxt,()=>{e.var(Z.default.instancePath,(0,A._)`${Z.default.valCxt}.${Z.default.instancePath}`),e.var(Z.default.parentData,(0,A._)`${Z.default.valCxt}.${Z.default.parentData}`),e.var(Z.default.parentDataProperty,(0,A._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),e.var(Z.default.rootData,(0,A._)`${Z.default.valCxt}.${Z.default.rootData}`),t.dynamicRef&&e.var(Z.default.dynamicAnchors,(0,A._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`)},()=>{e.var(Z.default.instancePath,(0,A._)`""`),e.var(Z.default.parentData,(0,A._)`undefined`),e.var(Z.default.parentDataProperty,(0,A._)`undefined`),e.var(Z.default.rootData,Z.default.data),t.dynamicRef&&e.var(Z.default.dynamicAnchors,(0,A._)`{}`)})}function ik(e){let{schema:t,opts:r,gen:n}=e;Gy(e,()=>{r.$comment&&t.$comment&&t_(e),dk(e),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&ak(e),e_(e),hk(e)})}function ak(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,A._)`${r}.evaluated`),t.if((0,A._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,A._)`${e.evaluated}.props`,(0,A._)`undefined`)),t.if((0,A._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,A._)`${e.evaluated}.items`,(0,A._)`undefined`))}function Hy(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,A._)`/*# sourceURL=${r} */`:A.nil}function ck(e,t){if(Yy(e)&&(Qy(e),Xy(e))){uk(e,t);return}(0,Wy.boolOrEmptySchema)(e,t)}function Xy({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 Yy(e){return typeof e.schema!="boolean"}function uk(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&t_(e),fk(e),pk(e);let s=n.const("_errs",Z.default.errors);e_(e,s),n.var(t,(0,A._)`${s} === ${Z.default.errors}`)}function Qy(e){(0,At.checkUnknownRules)(e),lk(e)}function e_(e,t){if(e.opts.jtd)return Ky(e,[],!1,t);let r=(0,Vy.getSchemaTypes)(e.schema),n=(0,Vy.coerceAndCheckDataType)(e,r);Ky(e,r,!n,t)}function lk(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,At.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function dk(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,At.checkStrictMode)(e,"default is ignored in the schema root")}function fk(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rk.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function pk(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function t_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,A._)`${Z.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,A.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,A._)`${Z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function hk(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,A._)`${Z.default.errors} === 0`,()=>t.return(Z.default.data),()=>t.throw((0,A._)`new ${o}(${Z.default.vErrors})`)):(t.assign((0,A._)`${n}.errors`,Z.default.vErrors),s.unevaluated&&mk(e),t.return((0,A._)`${Z.default.errors} === 0`))}function mk({gen:e,evaluated:t,props:r,items:n}){r instanceof A.Name&&e.assign((0,A._)`${t}.props`,r),n instanceof A.Name&&e.assign((0,A._)`${t}.items`,n)}function Ky(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,At.schemaHasRulesButRef)(s,l))){o.block(()=>n_(e,"$ref",l.all.$ref.definition));return}c.jtd||gk(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Vu.shouldUseGroup)(s,p)&&(p.type?(o.if((0,$i.checkDataType)(p.type,i,c.strictNumbers)),Jy(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,$i.reportTypeError)(e)),o.endIf()):Jy(e,p),a||o.if((0,A._)`${Z.default.errors} === ${n||0}`))}}function Jy(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,tk.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Vu.shouldUseRule)(n,s)&&n_(e,s.keyword,s.definition,t.type)})}function gk(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(yk(e,t),e.opts.allowUnionTypes||_k(e,t),bk(e,e.dataTypes))}function yk(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{r_(e.dataTypes,r)||Hu(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),xk(e,t)}}function _k(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Hu(e,"use allowUnionTypes to allow union type keyword")}function bk(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Vu.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>wk(t,i))&&Hu(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function wk(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function r_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function xk(e,t){let r=[];for(let n of e.dataTypes)r_(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Hu(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,At.checkStrictMode)(e,t,e.opts.strictTypes)}var Si=class{constructor(t,r,n){if((0,_o.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,At.schemaRefOrVal)(t,this.schema,n,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",o_(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,_o.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",Z.default.errors))}result(t,r,n){this.failResult((0,A.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():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,A.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,A._)`${r} !== undefined && (${(0,A.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?yo.reportExtraError:yo.reportError)(this,this.def.error,r)}$dataError(){(0,yo.reportError)(this,this.def.$dataError||yo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,yo.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,n=A.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=A.nil,r=A.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,A.or)((0,A._)`${o} === undefined`,r)),t!==A.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==A.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,A.or)(i(),a());function i(){if(n.length){if(!(r instanceof A.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,A._)`${(0,$i.checkDataTypes)(c,r,s.opts.strictNumbers,$i.DataType.Wrong)}`}return A.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,A._)`!${c}(${r})`}return A.nil}}subschema(t,r){let n=(0,Bu.getSubschema)(this.it,t);(0,Bu.extendSubschemaData)(n,this.it,t),(0,Bu.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return ck(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=At.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=At.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,A.Name)),!0}};Yt.KeywordCxt=Si;function n_(e,t,r,n){let o=new Si(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,_o.funcKeywordCode)(o,r):"macro"in r?(0,_o.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,_o.funcKeywordCode)(o,r)}var vk=/^\/(?:[^~]|~0|~1)*$/,$k=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function o_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return Z.default.rootData;if(e[0]==="/"){if(!vk.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=Z.default.rootData}else{let u=$k.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,A._)`${s}${(0,A.getProperty)((0,At.unescapeJsonPointer)(u))}`,i=(0,A._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Yt.getData=o_});var zi=P(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});var Ku=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Ju.default=Ku});var wo=P(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});var Wu=go(),Gu=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Wu.resolveUrl)(t,r,n),this.missingSchema=(0,Wu.normalizeId)((0,Wu.getFullPath)(t,this.missingRef))}};Xu.default=Gu});var Pi=P(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.resolveSchema=et.getCompilingSchema=et.resolveRef=et.compileSchema=et.SchemaEnv=void 0;var ct=U(),Sk=zi(),yr=Rt(),ut=go(),s_=K(),zk=bo(),un=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=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,ut.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};et.SchemaEnv=un;function Qu(e){let t=i_.call(this,e);if(t)return t;let r=(0,ut.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ct.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:Sk.default,code:(0,ct._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:yr.default.data,parentData:yr.default.parentData,parentDataProperty:yr.default.parentDataProperty,dataNames:[yr.default.data],dataPathArr:[ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ct.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ct.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ct._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,zk.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(yr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${yr.default.self}`,`${yr.default.scope}`,l)(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:h,items:m}=u;f.evaluated={props:h instanceof ct.Name?void 0:h,items:m instanceof ct.Name?void 0:m,dynamicProps:h instanceof ct.Name,dynamicItems:m instanceof ct.Name},f.source&&(f.source.evaluated=(0,ct.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}et.compileSchema=Qu;function kk(e,t,r){var n;r=(0,ut.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=Tk.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new un({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Pk.call(this,s)}et.resolveRef=kk;function Pk(e){return(0,ut.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Qu.call(this,e)}function i_(e){for(let t of this._compilations)if(Ek(t,e))return t}et.getCompilingSchema=i_;function Ek(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Tk(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||ki.call(this,e,t)}function ki(e,t){let r=this.opts.uriResolver.parse(t),n=(0,ut._getFullPath)(this.opts.uriResolver,r),o=(0,ut.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Yu.call(this,r,e);let s=(0,ut.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=ki.call(this,e,i);return typeof a?.schema!="object"?void 0:Yu.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Qu.call(this,i),s===(0,ut.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,ut.resolveUrl)(this.opts.uriResolver,o,u)),new un({schema:a,schemaId:c,root:e,baseId:o})}return Yu.call(this,r,i)}}et.resolveSchema=ki;var Ok=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Yu(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,s_.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Ok.has(a)&&u&&(t=(0,ut.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,s_.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ut.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=ki.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new un({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var a_=P((o4,Rk)=>{Rk.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 sl=P((s4,h_)=>{"use strict";var Ak=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),tl=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Ck=RegExp.prototype.test.bind(/^\d*$/u),_r=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),rl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),u_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),nl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Ik=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Fe=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Fe[t]="%"+e[t>>4]+e[t&15]}function Ae(e){return e<2048?Fe[192|e>>6]+Fe[128|e&63]:e<65536?Fe[224|e>>12]+Fe[128|e>>6&63]+Fe[128|e&63]:Fe[240|e>>18]+Fe[128|e>>12&63]+Fe[128|e>>6&63]+Fe[128|e&63]}function Nk(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var jk=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Zk=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Dk=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Mk=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Lk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Dk(e[t])){if(e[t]==="%"&&t+2<e.length&&_r(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function c_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]==="0"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function Uk(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(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!tl(c))return;s+=2;continue}if(!jk(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:c_(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return c_(i)}function el(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 n=t?e.slice(1,-1):e;if(t&&Zk(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(qk(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!Lk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=Uk(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function qk(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Fk(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===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(o===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((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Bk={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Vk=/[@/?#:]/g,Hk=/[@/?#]/g;function l_(e,t){let r=t?Hk:Vk;return r.lastIndex=0,e.replace(r,n=>Bk[n])}function d_(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(_r(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&rl(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function Kk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(_r(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&rl(i)?t+=i:t+="%"+s,r+=2;continue}}if(u_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=p_(o)?n:Fe[o];else if(o<55296||o>57343)t+=Ae(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Ae(65536+(o-55296<<10)+(s-56320)),r++):t+=Ae(65533)}else t+=Ae(65533)}}return t}function Jk(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(_r(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),u_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Fe[i];else if(i<55296||i>57343)r+=Ae(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=Ae(65536+(i-55296<<10)+(a-56320)),o++):r+=Ae(65533)}else r+=Ae(65533)}}return r}function ol(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(_r(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Fe[s];else if(s<55296||s>57343)r+=Ae(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=Ae(65536+(s-55296<<10)+(i-56320)),n++):r+=Ae(65533)}else r+=Ae(65533)}}return r}function f_(e){return ol(e,Ik)}function Wk(e){return ol(e,nl)}function Gk(e){return ol(e,nl)}function p_(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 Xk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(_r(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));rl(i)?t+=i:t+="%"+s,r+=2;continue}}if(nl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=p_(o)?n:Fe[o];else if(o<55296||o>57343)t+=Ae(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Ae(65536+(o-55296<<10)+(s-56320)),r++):t+=Ae(65533)}else t+=Ae(65533)}}return t}function Yk(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(_r(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Qk(e){let t=[];if(e.userinfo!==void 0&&(t.push(f_(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!tl(r)){let n=el(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=d_(r,!0),n=el(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=l_(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Ck(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}h_.exports={nonSimpleDomain:Mk,recomposeAuthority:Qk,reescapeHostDelimiters:l_,normalizePercentEncoding:d_,normalizePathEncoding:Kk,serializePathEncoding:Jk,normalizeQueryFragmentEncoding:Xk,encodeUserinfo:f_,encodeQuery:Wk,encodeFragment:Gk,escapePreservingEscapes:Yk,removeDotSegments:Fk,isIPv4:tl,isUUID:Ak,normalizeIPv6:el,stringArrayToHexStripped:Nk}});var b_=P((i4,__)=>{"use strict";var{isUUID:e1}=sl(),t1=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,r1=["http","https","ws","wss","urn","urn:uuid"];function n1(e){return r1.indexOf(e)!==-1}function il(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 m_(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function g_(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 o1(e){return e.secure=il(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function s1(e){if((e.port===(il(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 i1(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(t1);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=al(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function a1(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=al(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function c1(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!e1(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function u1(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var y_={scheme:"http",domainHost:!0,parse:m_,serialize:g_},l1={scheme:"https",domainHost:y_.domainHost,parse:m_,serialize:g_},Ei={scheme:"ws",domainHost:!0,parse:o1,serialize:s1},d1={scheme:"wss",domainHost:Ei.domainHost,parse:Ei.parse,serialize:Ei.serialize},f1={scheme:"urn",parse:i1,serialize:a1,skipNormalize:!0},p1={scheme:"urn:uuid",parse:c1,serialize:u1,skipNormalize:!0},Ti={http:y_,https:l1,ws:Ei,wss:d1,urn:f1,"urn:uuid":p1};Object.setPrototypeOf(Ti,null);function al(e){return e&&(Ti[e]||Ti[e.toLowerCase()])||void 0}__.exports={wsIsSecure:il,SCHEMES:Ti,isValidSchemeName:n1,getSchemeHandler:al}});var A_=P((a4,Ai)=>{"use strict";var{normalizeIPv6:S_,removeDotSegments:vo,recomposeAuthority:h1,normalizePercentEncoding:cl,normalizePathEncoding:m1,serializePathEncoding:w_,normalizeQueryFragmentEncoding:x_,encodeQuery:g1,encodeFragment:y1,reescapeHostDelimiters:_1,isIPv4:z_,nonSimpleDomain:b1}=sl(),{SCHEMES:k_,getSchemeHandler:ul}=b_(),P_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,E_="URI scheme is malformed.";function v_(e){let t=unescape(String(e));if(!P_.test(t))throw new TypeError(E_);return t}function w1(e,t){return typeof e=="string"?e=E1(e,t):typeof e=="object"&&(e=Ri(br(e,t),t)),e}function x1(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=Oi(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:h,malformedScheme:m}=Oi(t,n);if(s||d||i||p||a||f||c||h||u||m)throw new Error(o.error||l.error||"URI is malformed.");let y=T_(o,l,n,!0),_=ul(r&&r.scheme||y.scheme),v=y.host,$=v!==void 0&&v!==""&&(z_(v)||S_(v).isIPV6);O_(y,r||{},_,$);let C=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(y.error&&!C)throw new Error(y.error);return n.skipEscape=!0,br(y,n)}function T_(e,t,r,n){let o={};return n||(e=Ri(br(e,r),r),t=Ri(br(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=vo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=vo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=vo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=vo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function v1(e,t,r){let n=$_(e,r),o=$_(t,r);return n!==void 0&&o!==void 0&&n===o}function br(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:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=v_(r.scheme));let s=ul(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=cl(r.path):r.path=w_(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=v_(r.scheme),o.push(r.scheme,":"));let c=h1(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(u=vo(u)),a&&(u=w_(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",g1(r.query)),r.fragment!==void 0&&o.push("#",y1(r.fragment)),o.join("")}var $1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,S1=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,z1=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function k1(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 xo(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 ll(e){return e[0]==="["&&e[e.length-1]==="]"}function P1(e){let t=e[4];return xo(e[3])||t!==void 0&&!ll(t)&&xo(t)||xo(e[6])||xo(e[7])||xo(e[8])}function O_(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!ll(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&b1(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function Oi(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(S1);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let p=e.match(z1);if(p!==null){let h=p[1],m=h.replace(/[\t\n\r]/g,"");m.length>=2&&(m.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):h.length!==m.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match($1);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);P_.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||E_,u=!0)}s=P1(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let h=k1(n,f);if(h!==void 0&&(n.error=n.error||h,o=!0),n.host)if(z_(n.host)===!1){let _=ll(n.host),v=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,$=S_(n.host);l=$.isIPV6||$.isIPVFuture===!0,c=v&&(!_||$.error===!0),n.host=l?$.host:$.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let m=ul(r.scheme||n.scheme);if(c||(a=O_(n,r,m,l)),e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:cl(n.host,!0);l||(y=cl(y.toLowerCase())),n.host=_1(y,l)}(!m||m&&!m.skipNormalize)&&(n.path&&(n.path=m1(n.path)),n.query&&(n.query=x_(n.query)),n.fragment&&(n.fragment=x_(n.fragment))),m&&m.parse&&(m.parse(n,r),m===k_.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function Ri(e,t){return Oi(e,t).parsed}function E1(e,t){return R_(e,t).normalized}function R_(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Oi(e,t);return{normalized:n||o||s||i||a?e:br(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function $_(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:br(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=R_(r,t);return o||s||i||a||c?void 0:n}var dl={SCHEMES:k_,normalize:w1,resolve:x1,resolveComponent:T_,equal:v1,serialize:br,parse:Ri};Ai.exports=dl;Ai.exports.default=dl;Ai.exports.fastUri=dl});var I_=P(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});var C_=A_();C_.code='require("ajv/dist/runtime/uri").default';fl.default=C_});var q_=P(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.CodeGen=ke.Name=ke.nil=ke.stringify=ke.str=ke._=ke.KeywordCxt=void 0;var T1=bo();Object.defineProperty(ke,"KeywordCxt",{enumerable:!0,get:function(){return T1.KeywordCxt}});var ln=U();Object.defineProperty(ke,"_",{enumerable:!0,get:function(){return ln._}});Object.defineProperty(ke,"str",{enumerable:!0,get:function(){return ln.str}});Object.defineProperty(ke,"stringify",{enumerable:!0,get:function(){return ln.stringify}});Object.defineProperty(ke,"nil",{enumerable:!0,get:function(){return ln.nil}});Object.defineProperty(ke,"Name",{enumerable:!0,get:function(){return ln.Name}});Object.defineProperty(ke,"CodeGen",{enumerable:!0,get:function(){return ln.CodeGen}});var O1=zi(),M_=wo(),R1=Iu(),$o=Pi(),A1=U(),So=go(),Ci=mo(),hl=K(),N_=a_(),C1=I_(),L_=(e,t)=>new RegExp(e,t);L_.code="new RegExp";var I1=["removeAdditional","useDefaults","coerceTypes"],N1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),j1={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."},Z1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},j_=200;function D1(e){var t,r,n,o,s,i,a,c,u,l,d,p,f,h,m,y,_,v,$,C,w,x,E,W,D;let S=e.strict,T=(t=e.code)===null||t===void 0?void 0:t.optimize,M=T===!0||T===void 0?1:T||0,F=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:L_,V=(o=e.uriResolver)!==null&&o!==void 0?o:C1.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:S)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:S)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:S)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:S)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:S)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:M,regExp:F}:{optimize:M,regExp:F},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:j_,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:j_,meta:(_=e.meta)!==null&&_!==void 0?_:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:($=e.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(E=e.validateFormats)!==null&&E!==void 0?E:!0,unicodeRegExp:(W=e.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:(D=e.int32range)!==null&&D!==void 0?D:!0,uriResolver:V}}var zo=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,...D1(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new A1.ValueScope({scope:{},prefixes:N1,es5:r,lines:n}),this.logger=B1(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,R1.getRules)(),Z_.call(this,j1,t,"NOT SUPPORTED"),Z_.call(this,Z1,t,"DEPRECATED","warn"),this._metaOpts=q1.call(this),t.formats&&L1.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&U1.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),M1.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=N_;n==="id"&&(o={...N_},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!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 n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof M_.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);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,So.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=D_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new $o.SchemaEnv({schema:{},schemaId:n});if(r=$o.resolveSchema.call(this,o,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=D_.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 n=t[this.opts.schemaId];return n&&(n=(0,So.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(H1.call(this,n,r),!r)return(0,hl.eachItem)(n,s=>pl.call(this,s)),this;J1.call(this,r);let o={...r,type:(0,Ci.getJSONTypes)(r.type),schemaType:(0,Ci.getJSONTypes)(r.schemaType)};return(0,hl.eachItem)(n,o.type.length===0?s=>pl.call(this,s,o):s=>o.type.forEach(i=>pl.call(this,s,o,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 n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,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:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=U_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=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;n=(0,So.normalizeId)(i||n);let u=So.getSchemaRefs.call(this,t,n);return c=new $o.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&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):$o.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{$o.compileSchema.call(this,t)}finally{this.opts=r}}};zo.ValidationError=O1.default;zo.MissingRefError=M_.default;ke.default=zo;function Z_(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function D_(e){return e=(0,So.normalizeId)(e),this.schemas[e]||this.refs[e]}function M1(){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 L1(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function U1(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 q1(){let e={...this.opts};for(let t of I1)delete e[t];return e}var F1={log(){},warn(){},error(){}};function B1(e){if(e===!1)return F1;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 V1=/^[a-z_$][a-z0-9_$:-]*$/i;function H1(e,t){let{RULES:r}=this;if((0,hl.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!V1.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function pl(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?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,Ci.getJSONTypes)(t.type),schemaType:(0,Ci.getJSONTypes)(t.schemaType)}};t.before?K1.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function K1(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function J1(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=U_(t)),e.validateSchema=this.compile(t,!0))}var W1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function U_(e){return{anyOf:[e,W1]}}});var F_=P(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});var G1={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ml.default=G1});var K_=P(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.callRef=wr.getValidate=void 0;var X1=wo(),B_=Qe(),Be=U(),dn=Rt(),V_=Pi(),Ii=K(),Y1={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=V_.resolveRef.call(c,u,o,r);if(l===void 0)throw new X1.default(n.opts.uriResolver,o,r);if(l instanceof V_.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Ni(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Ni(e,(0,Be._)`${h}.validate`,u,u.$async)}function p(h){let m=H_(e,h);Ni(e,m,h,h.$async)}function f(h){let m=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Be.stringify)(h)}:{ref:h}),y=t.name("valid"),_=e.subschema({schema:h,dataTypes:[],schemaPath:Be.nil,topSchemaRef:m,errSchemaPath:r},y);e.mergeEvaluated(_),e.ok(y)}}};function H_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:t})}.validate`}wr.getValidate=H_;function Ni(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?dn.default.this:Be.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Be._)`await ${(0,B_.callValidateCode)(e,t,u)}`),f(t),i||o.assign(h,!0)},m=>{o.if((0,Be._)`!(${m} instanceof ${s.ValidationError})`,()=>o.throw(m)),p(m),i||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,B_.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(h){let m=(0,Be._)`${h}.errors`;o.assign(dn.default.vErrors,(0,Be._)`${dn.default.vErrors} === null ? ${m} : ${dn.default.vErrors}.concat(${m})`),o.assign(dn.default.errors,(0,Be._)`${dn.default.vErrors}.length`)}function f(h){var m;if(!s.opts.unevaluated)return;let y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=Ii.mergeEvaluated.props(o,y.props,s.props));else{let _=o.var("props",(0,Be._)`${h}.evaluated.props`);s.props=Ii.mergeEvaluated.props(o,_,s.props,Be.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=Ii.mergeEvaluated.items(o,y.items,s.items));else{let _=o.var("items",(0,Be._)`${h}.evaluated.items`);s.items=Ii.mergeEvaluated.items(o,_,s.items,Be.Name)}}}wr.callRef=Ni;wr.default=Y1});var J_=P(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});var Q1=F_(),eP=K_(),tP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q1.default,eP.default];gl.default=tP});var W_=P(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var ji=U(),Qt=ji.operators,Zi={maximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},minimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},exclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},exclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},rP={message:({keyword:e,schemaCode:t})=>(0,ji.str)`must be ${Zi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ji._)`{comparison: ${Zi[e].okStr}, limit: ${t}}`},nP={keyword:Object.keys(Zi),type:"number",schemaType:"number",$data:!0,error:rP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,ji._)`${r} ${Zi[t].fail} ${n} || isNaN(${r})`)}};yl.default=nP});var G_=P(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});var ko=U(),oP={message:({schemaCode:e})=>(0,ko.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ko._)`{multipleOf: ${e}}`},sP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:oP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,ko._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,ko._)`${i} !== parseInt(${i})`;e.fail$data((0,ko._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};_l.default=sP});var Y_=P(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});function X_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}bl.default=X_;X_.code='require("ajv/dist/runtime/ucs2length").default'});var Q_=P(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});var xr=U(),iP=K(),aP=Y_(),cP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,xr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,xr._)`{limit: ${e}}`},uP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:cP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?xr.operators.GT:xr.operators.LT,i=o.opts.unicode===!1?(0,xr._)`${r}.length`:(0,xr._)`${(0,iP.useFunc)(e.gen,aP.default)}(${r})`;e.fail$data((0,xr._)`${i} ${s} ${n}`)}};wl.default=uP});var e0=P(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});var lP=Qe(),dP=K(),fn=U(),fP={message:({schemaCode:e})=>(0,fn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,fn._)`{pattern: ${e}}`},pP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:fP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,fn._)`new RegExp`:(0,dP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,fn._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,fn._)`!${l}`)}else{let c=(0,lP.usePattern)(e,o);e.fail$data((0,fn._)`!${c}.test(${r})`)}}};xl.default=pP});var t0=P(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var Po=U(),hP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Po.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Po._)`{limit: ${e}}`},mP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:hP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Po.operators.GT:Po.operators.LT;e.fail$data((0,Po._)`Object.keys(${r}).length ${o} ${n}`)}};vl.default=mP});var r0=P($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});var Eo=Qe(),To=U(),gP=K(),yP={message:({params:{missingProperty:e}})=>(0,To.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,To._)`{missingProperty: ${e}}`},_P={keyword:"required",type:"object",schemaType:"array",$data:!0,error:yP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if(f?.[m]===void 0&&!h.has(m)){let y=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,gP.checkStrictMode)(i,_,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(To.nil,d);else for(let f of r)(0,Eo.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>p(f,h)),e.ok(h)}else t.if((0,Eo.checkMissingProp)(e,r,f)),(0,Eo.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,Eo.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function p(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,(0,Eo.propertyInData)(t,o,f,a.ownProperties)),t.if((0,To.not)(h),()=>{e.error(),t.break()})},To.nil)}}};$l.default=_P});var n0=P(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var Oo=U(),bP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Oo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Oo._)`{limit: ${e}}`},wP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:bP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Oo.operators.GT:Oo.operators.LT;e.fail$data((0,Oo._)`${r}.length ${o} ${n}`)}};Sl.default=wP});var Di=P(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});var o0=qu();o0.code='require("ajv/dist/runtime/equal").default';zl.default=o0});var s0=P(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});var kl=mo(),Pe=U(),xP=K(),vP=Di(),$P={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},SP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$P,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,kl.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,Pe._)`${i} === false`),e.ok(c);function l(){let h=t.let("i",(0,Pe._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(c,!0),t.if((0,Pe._)`${h} > 1`,()=>(d()?p:f)(h,m))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,m){let y=t.name("item"),_=(0,kl.checkDataTypes)(u,y,a.opts.strictNumbers,kl.DataType.Wrong),v=t.const("indices",(0,Pe._)`{}`);t.for((0,Pe._)`;${h}--;`,()=>{t.let(y,(0,Pe._)`${r}[${h}]`),t.if(_,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${y} == "string"`,(0,Pe._)`${y} += "_"`),t.if((0,Pe._)`typeof ${v}[${y}] == "number"`,()=>{t.assign(m,(0,Pe._)`${v}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${v}[${y}] = ${h}`)})}function f(h,m){let y=(0,xP.useFunc)(t,vP.default),_=t.name("outer");t.label(_).for((0,Pe._)`;${h}--;`,()=>t.for((0,Pe._)`${m} = ${h}; ${m}--;`,()=>t.if((0,Pe._)`${y}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(_)})))}}};Pl.default=SP});var i0=P(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});var El=U(),zP=K(),kP=Di(),PP={message:"must be equal to constant",params:({schemaCode:e})=>(0,El._)`{allowedValue: ${e}}`},EP={keyword:"const",$data:!0,error:PP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,El._)`!${(0,zP.useFunc)(t,kP.default)}(${r}, ${o})`):e.fail((0,El._)`${s} !== ${r}`)}};Tl.default=EP});var a0=P(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});var Ro=U(),TP=K(),OP=Di(),RP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ro._)`{allowedValues: ${e}}`},AP={keyword:"enum",schemaType:"array",$data:!0,error:RP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,TP.useFunc)(t,OP.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,Ro.or)(...o.map((h,m)=>p(f,m)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,Ro._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,h){let m=o[h];return typeof m=="object"&&m!==null?(0,Ro._)`${u()}(${r}, ${f}[${h}])`:(0,Ro._)`${r} === ${m}`}}};Ol.default=AP});var c0=P(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});var CP=W_(),IP=G_(),NP=Q_(),jP=e0(),ZP=t0(),DP=r0(),MP=n0(),LP=s0(),UP=i0(),qP=a0(),FP=[CP.default,IP.default,NP.default,jP.default,ZP.default,DP.default,MP.default,LP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},UP.default,qP.default];Rl.default=FP});var Cl=P(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.validateAdditionalItems=void 0;var vr=U(),Al=K(),BP={message:({params:{len:e}})=>(0,vr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,vr._)`{limit: ${e}}`},VP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:BP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Al.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}u0(e,n)}};function u0(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,vr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,vr._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Al.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,vr._)`${a} <= ${t.length}`);r.if((0,vr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:Al.Type.Num},u),i.allErrors||r.if((0,vr.not)(u),()=>r.break())})}}Ao.validateAdditionalItems=u0;Ao.default=VP});var Il=P(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.validateTuple=void 0;var l0=U(),Mi=K(),HP=Qe(),KP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return d0(e,"additionalItems",t);r.items=!0,!(0,Mi.alwaysValidSchema)(r,t)&&e.ok((0,HP.validateArray)(e))}};function d0(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Mi.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,l0._)`${s}.length`);r.forEach((d,p)=>{(0,Mi.alwaysValidSchema)(a,d)||(n.if((0,l0._)`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,m=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!m){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Mi.checkStrictMode)(a,y,p.strictTuples)}}}Co.validateTuple=d0;Co.default=KP});var f0=P(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});var JP=Il(),WP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,JP.validateTuple)(e,"items")};Nl.default=WP});var h0=P(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var p0=U(),GP=K(),XP=Qe(),YP=Cl(),QP={message:({params:{len:e}})=>(0,p0.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,p0._)`{limit: ${e}}`},eE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:QP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,GP.alwaysValidSchema)(n,t)&&(o?(0,YP.validateAdditionalItems)(e,o):e.ok((0,XP.validateArray)(e)))}};jl.default=eE});var m0=P(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});var tt=U(),Li=K(),tE={message:({params:{min:e,max:t}})=>t===void 0?(0,tt.str)`must contain at least ${e} valid item(s)`:(0,tt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,tt._)`{minContains: ${e}}`:(0,tt._)`{minContains: ${e}, maxContains: ${t}}`},rE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:tE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,tt._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Li.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Li.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Li.alwaysValidSchema)(s,r)){let m=(0,tt._)`${l} >= ${i}`;a!==void 0&&(m=(0,tt._)`${m} && ${l} <= ${a}`),e.pass(m);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,tt._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let m=t.name("_valid"),y=t.let("count",0);f(m,()=>t.if(m,()=>h(y)))}function f(m,y){t.forRange("i",0,l,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:Li.Type.Num,compositeRule:!0},m),y()})}function h(m){t.code((0,tt._)`${m}++`),a===void 0?t.if((0,tt._)`${m} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,tt._)`${m} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,tt._)`${m} >= ${i}`,()=>t.assign(d,!0)))}}};Zl.default=rE});var _0=P(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.validateSchemaDeps=gt.validatePropertyDeps=gt.error=void 0;var Dl=U(),nE=K(),Io=Qe();gt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Dl.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Dl._)`{property: ${e},
|
|
8
8
|
missingProperty: ${n},
|
|
9
9
|
depsCount: ${t},
|
|
10
|
-
deps: ${r}}`};var tE={keyword:"dependencies",type:"object",schemaType:"object",error:ht.error,code(e){let[t,r]=rE(e);p0(e,t),h0(e,r)}};function rE({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function p0(e,t=e.schema){let{gen:r,data:n,it:o}=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,Ao.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Ao.checkReportMissingProp)(e,u)}):(r.if((0,Zl._)`${c} && (${(0,Ao.checkMissingProp)(e,a,s)})`),(0,Ao.reportMissingProp)(e,s),r.else())}}ht.validatePropertyDeps=p0;function h0(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,eE.alwaysValidSchema)(s,t[a])||(r.if((0,Ao.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}ht.validateSchemaDeps=h0;ht.default=tE});var y0=E(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});var g0=L(),nE=B(),oE={message:"property name must be valid",params:({params:e})=>(0,g0._)`{propertyName: ${e.propertyName}}`},sE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:oE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,nE.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,g0.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Dl.default=sE});var Ll=E(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});var Di=We(),it=L(),iE=Ot(),Mi=B(),aE={message:"must NOT have additional properties",params:({params:e})=>(0,it._)`{additionalProperty: ${e.additionalProperty}}`},cE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:aE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,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,Mi.alwaysValidSchema)(i,r))return;let u=(0,Di.allSchemaProperties)(n.properties),l=(0,Di.allSchemaProperties)(n.patternProperties);d(),e.ok((0,it._)`${s} === ${iE.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(p(y),()=>h(y))})}function p(y){let w;if(u.length>8){let v=(0,Mi.schemaRefOrVal)(i,n.properties,"properties");w=(0,Di.isOwnProperty)(t,v,y)}else u.length?w=(0,it.or)(...u.map(v=>(0,it._)`${y} === ${v}`)):w=it.nil;return l.length&&(w=(0,it.or)(w,...l.map(v=>(0,it._)`${(0,Di.usePattern)(e,v)}.test(${y})`))),(0,it.not)(w)}function f(y){t.code((0,it._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Mi.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(m(y,w,!1),t.if((0,it.not)(w),()=>{e.reset(),f(y)})):(m(y,w),a||t.if((0,it.not)(w),()=>t.break()))}}function m(y,w,v){let S={keyword:"additionalProperties",dataProp:y,dataPropType:Mi.Type.Str};v===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,w)}}};Ml.default=cE});var w0=E(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});var uE=yo(),_0=We(),Ul=B(),b0=Ll(),lE={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&b0.default.code(new uE.KeywordCxt(s,b0.default,"additionalProperties"));let i=(0,_0.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ul.mergeEvaluated.props(t,(0,Ul.toHash)(i),s.props));let a=i.filter(d=>!(0,Ul.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,_0.propertyInData)(t,o,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ql.default=lE});var S0=E(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});var x0=We(),Li=L(),v0=B(),$0=B(),dE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,x0.allSchemaProperties)(r),c=a.filter(m=>(0,v0.alwaysValidSchema)(s,r[m]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof Li.Name)&&(s.props=(0,$0.evaluatedPropsToName)(t,s.props));let{props:d}=s;p();function p(){for(let m of a)u&&f(m),s.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function f(m){for(let y in u)new RegExp(m).test(y)&&(0,v0.checkStrictMode)(s,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,y=>{t.if((0,Li._)`${(0,x0.usePattern)(e,m)}.test(${y})`,()=>{let w=c.includes(m);w||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:$0.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Li._)`${d}[${y}]`,!0):!w&&!s.allErrors&&t.if((0,Li.not)(l),()=>t.break())})})}}};Fl.default=dE});var z0=E(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});var fE=B(),pE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,fE.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Bl.default=pE});var k0=E(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});var hE=We(),mE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hE.validateUnion,error:{message:"must match a schema in anyOf"}};Vl.default=mE});var P0=E(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});var Ui=L(),gE=B(),yE={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ui._)`{passingSchemas: ${e.passing}}`},_E={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:yE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.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(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let p;(0,gE.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ui._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ui._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),p&&e.mergeEvaluated(p,Ui.Name)})})}}};Hl.default=_E});var E0=E(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});var bE=B(),wE={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,bE.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Kl.default=wE});var R0=E(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});var qi=L(),O0=B(),xE={message:({params:e})=>(0,qi.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,qi._)`{failingKeyword: ${e.ifClause}}`},vE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:xE,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,O0.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=T0(n,"then"),s=T0(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,qi.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(p,i),d?t.assign(d,(0,qi._)`${l}`):e.setParams({ifClause:l})}}}};function T0(e,t){let r=e.schema[t];return r!==void 0&&!(0,O0.alwaysValidSchema)(e,r)}Jl.default=vE});var A0=E(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var $E=B(),SE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,$E.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Wl.default=SE});var C0=E(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});var zE=Al(),kE=u0(),PE=Cl(),EE=d0(),TE=f0(),OE=m0(),RE=y0(),AE=Ll(),CE=w0(),IE=S0(),NE=z0(),jE=k0(),ZE=P0(),DE=E0(),ME=R0(),LE=A0();function UE(e=!1){let t=[NE.default,jE.default,ZE.default,DE.default,ME.default,LE.default,RE.default,AE.default,OE.default,CE.default,IE.default];return e?t.push(kE.default,EE.default):t.push(zE.default,PE.default),t.push(TE.default),t}Gl.default=UE});var I0=E(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});var de=L(),qE={message:({schemaCode:e})=>(0,de.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,de._)`{format: ${e}}`},FE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qE,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,de._)`${h}[${i}]`),y=r.let("fType"),w=r.let("format");r.if((0,de._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,de._)`${m}.type || "string"`).assign(w,(0,de._)`${m}.validate`),()=>r.assign(y,(0,de._)`"string"`).assign(w,m)),e.fail$data((0,de.or)(v(),S()));function v(){return c.strictSchema===!1?de.nil:(0,de._)`${i} && !${w}`}function S(){let T=l.$async?(0,de._)`(${m}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,de._)`${w}(${n})`,_=(0,de._)`(typeof ${w} == "function" ? ${T} : ${w}.test(${n}))`;return(0,de._)`${w} && ${w} !== true && ${y} === ${t} && !${_}`}}function f(){let h=d.formats[s];if(!h){v();return}if(h===!0)return;let[m,y,w]=S(h);m===t&&e.pass(T());function v(){if(c.strictSchema===!1){d.logger.warn(_());return}throw new Error(_());function _(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function S(_){let x=_ instanceof RegExp?(0,de.regexpCode)(_):c.code.formats?(0,de._)`${c.code.formats}${(0,de.getProperty)(s)}`:void 0,$=r.scopeValue("formats",{key:s,ref:_,code:x});return typeof _=="object"&&!(_ instanceof RegExp)?[_.type||"string",_.validate,(0,de._)`${$}.validate`]:["string",_,$]}function T(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,de._)`await ${w}(${n})`}return typeof y=="function"?(0,de._)`${w}(${n})`:(0,de._)`${w}.test(${n})`}}}};Xl.default=FE});var N0=E(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var BE=I0(),VE=[BE.default];Yl.default=VE});var j0=E(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.contentVocabulary=dn.metadataVocabulary=void 0;dn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var D0=E(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var HE=V_(),KE=s0(),JE=C0(),WE=N0(),Z0=j0(),GE=[HE.default,KE.default,(0,JE.default)(),WE.default,Z0.metadataVocabulary,Z0.contentVocabulary];Ql.default=GE});var L0=E(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.DiscrError=void 0;var M0;(function(e){e.Tag="tag",e.Mapping="mapping"})(M0||(Fi.DiscrError=M0={}))});var q0=E(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var fn=L(),ed=L0(),U0=Si(),XE=_o(),YE=B(),QE={message:({params:{discrError:e,tagName:t}})=>e===ed.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,fn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},eT={keyword:"discriminator",type:"object",schemaType:"object",error:QE,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,fn._)`${r}${(0,fn.getProperty)(a)}`);t.if((0,fn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:ed.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=p();t.if(!1);for(let h in f)t.elseIf((0,fn._)`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:ed.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(m,fn.Name),h}function p(){var f;let h={},m=w(o),y=!0;for(let T=0;T<i.length;T++){let _=i[T];if(_?.$ref&&!(0,YE.schemaHasRulesButRef)(_,s.self.RULES)){let $=_.$ref;if(_=U0.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,$),_ instanceof U0.SchemaEnv&&(_=_.schema),_===void 0)throw new XE.default(s.opts.uriResolver,s.baseId,$)}let x=(f=_?.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(m||w(_)),v(x,T)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function w({required:T}){return Array.isArray(T)&&T.includes(a)}function v(T,_){if(T.const)S(T.const,_);else if(T.enum)for(let x of T.enum)S(x,_);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(T,_){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[T]=_}}}};td.default=eT});var F0=E((H4,tT)=>{tT.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 nd=E((oe,rd)=>{"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 rT=M_(),nT=D0(),oT=q0(),B0=F0(),sT=["/properties"],Bi="http://json-schema.org/draft-07/schema",pn=class extends rT.default{_addVocabularies(){super._addVocabularies(),nT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(oT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(B0,sT):B0;this.addMetaSchema(t,Bi,!1),this.refs["http://json-schema.org/schema"]=Bi}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bi)?Bi:void 0)}};oe.Ajv=pn;rd.exports=oe=pn;rd.exports.Ajv=pn;Object.defineProperty(oe,"__esModule",{value:!0});oe.default=pn;var iT=yo();Object.defineProperty(oe,"KeywordCxt",{enumerable:!0,get:function(){return iT.KeywordCxt}});var hn=L();Object.defineProperty(oe,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(oe,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(oe,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(oe,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(oe,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(oe,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var aT=vi();Object.defineProperty(oe,"ValidationError",{enumerable:!0,get:function(){return aT.default}});var cT=_o();Object.defineProperty(oe,"MissingRefError",{enumerable:!0,get:function(){return cT.default}})});var Y0=E(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.formatNames=gt.fastFormats=gt.fullFormats=void 0;function mt(e,t){return{validate:e,compare:t}}gt.fullFormats={date:mt(J0,ad),time:mt(sd(!0),cd),"date-time":mt(V0(!0),G0),"iso-time":mt(sd(),W0),"iso-date-time":mt(V0(),X0),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hT,"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:xT,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:mT,int32:{type:"number",validate:_T},int64:{type:"number",validate:bT},float:{type:"number",validate:K0},double:{type:"number",validate:K0},password:!0,binary:!0};gt.fastFormats={...gt.fullFormats,date:mt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ad),time:mt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,cd),"date-time":mt(/^\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,G0),"iso-time":mt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,W0),"iso-date-time":mt(/^\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,X0),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};gt.formatNames=Object.keys(gt.fullFormats);function uT(e){return e%4===0&&(e%100!==0||e%400===0)}var lT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function J0(e){let t=lT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&uT(r)?29:dT[n])}function ad(e,t){if(e&&t)return e>t?1:e<t?-1:0}var od=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function sd(e){return function(r){let n=od.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function cd(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function W0(e,t){if(!(e&&t))return;let r=od.exec(e),n=od.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var id=/t|\s/i;function V0(e){let t=sd(e);return function(n){let o=n.split(id);return o.length===2&&J0(o[0])&&t(o[1])}}function G0(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function X0(e,t){if(!(e&&t))return;let[r,n]=e.split(id),[o,s]=t.split(id),i=ad(r,o);if(i!==void 0)return i||cd(n,s)}var fT=/\/|:/,pT=/^(?:[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 hT(e){return fT.test(e)&&pT.test(e)}var H0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function mT(e){return H0.lastIndex=0,H0.test(e)}var gT=-(2**31),yT=2**31-1;function _T(e){return Number.isInteger(e)&&e<=yT&&e>=gT}function bT(e){return Number.isInteger(e)}function K0(){return!0}var wT=/[^\\]\\Z/;function xT(e){if(wT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Q0=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.formatLimitDefinition=void 0;var vT=nd(),at=L(),Qt=at.operators,Vi={formatMaximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},formatMinimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},formatExclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},formatExclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},$T={message:({keyword:e,schemaCode:t})=>(0,at.str)`should be ${Vi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,at._)`{comparison: ${Vi[e].okStr}, limit: ${t}}`};mn.formatLimitDefinition={keyword:Object.keys(Vi),type:"string",schemaType:"string",$data:!0,error:$T,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new vT.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,at._)`${p}[${c.schemaCode}]`);e.fail$data((0,at.or)((0,at._)`typeof ${f} != "object"`,(0,at._)`${f} instanceof RegExp`,(0,at._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,at._)`${i.code.formats}${(0,at.getProperty)(p)}`:void 0});e.fail$data(d(h))}function d(p){return(0,at._)`${p}.compare(${r}, ${n}) ${Vi[o].fail} 0`}},dependencies:["format"]};var ST=e=>(e.addKeyword(mn.formatLimitDefinition),e);mn.default=ST});var nb=E((Co,rb)=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});var gn=Y0(),zT=Q0(),ud=L(),eb=new ud.Name("fullFormats"),kT=new ud.Name("fastFormats"),ld=(e,t={keywords:!0})=>{if(Array.isArray(t))return tb(e,t,gn.fullFormats,eb),e;let[r,n]=t.mode==="fast"?[gn.fastFormats,kT]:[gn.fullFormats,eb],o=t.formats||gn.formatNames;return tb(e,o,r,n),t.keywords&&(0,zT.default)(e),e};ld.get=(e,t="full")=>{let n=(t==="fast"?gn.fastFormats:gn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function tb(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,ud._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}rb.exports=Co=ld;Object.defineProperty(Co,"__esModule",{value:!0});Co.default=ld});var ub=E(dd=>{"use strict";var ib=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,TT=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,ab=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,OT=/\\([\u000b\u0020-\u00ff])/g,RT=/([\\"])/g,cb=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;dd.format=AT;dd.parse=CT;function AT(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!cb.test(r))throw new TypeError("invalid type");var n=r;if(t&&typeof t=="object")for(var o,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(o=s[i],!ab.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+NT(t[o])}return n}function CT(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?IT(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!cb.test(n))throw new TypeError("invalid media type");var o=new jT(n.toLowerCase());if(r!==-1){var s,i,a;for(ib.lastIndex=r;i=ib.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(OT,"$1"))),o.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}function IT(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 NT(e){var t=String(e);if(ab.test(t))return t;if(t.length>0&&!TT.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(RT,"\\$1")+'"'}function jT(e){this.parameters=Object.create(null),this.type=e}});import{webcrypto as _O}from"node:crypto";import{parseArgs as bO}from"node:util";import{spawnSync as gw}from"node:child_process";import{createInterface as yw}from"node:readline/promises";function ua(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Jo=e=>e?`"${e}" `:"";function Fb(e,t=""){if(typeof e!="boolean")throw new TypeError(Jo(t)+"expected boolean, got type="+typeof e);return e}function Wo(e,t=""){if(typeof e!="number")throw new TypeError(Jo(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Jo(t)+"expected integer >= 0, got "+e);return e}function me(e,t,r=""){if(ua(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Wo(t,"length");let n=ua(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=Jo(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function Go(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Bb(e,t){me(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function la(e,t){if(Bb(e,t),!Or(e))throw new Error("invalid output, must be aligned")}function zd(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function _t(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ut(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Er(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Tr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function da(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}var ue=Tr?e=>e:e=>da(e)>>>0;function Vb(e){for(let t=0;t<e.length;t++)e[t]=da(e[t]);return e}var bn=Tr?e=>e:Vb;function kd(e,t){if(e=me(e),t=me(t),e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function fa(e,t,r){let n=t,o=r||(()=>[]),s=(a,c)=>n(c,...o(a)).update(a).digest(),i=n(new Uint8Array(e),...o(new Uint8Array(0)));return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.create=(a,...c)=>n(a,...c),s}var Pd=(e,t)=>{function r(n,...o){if(me(n,void 0,"key"),e.nonceLength!==void 0){let d=o[0];me(d,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let s=e.tagLength,i=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let d=i;d<o.length;d++)if(ua(o[d]))throw new Error("AAD not supported")}e.withAAD&&o[i]!==void 0&&me(o[i],void 0,"AAD");let a=t(n,...o),c=(d,p)=>{if(p!==void 0){if(d!==2)throw new Error("cipher output not supported");me(p,void 0,"output")}},u=!1;return{encrypt(d,p){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,me(d,void 0,"data"),c(a.encrypt.length,p),a.encrypt(d,p)},decrypt(d,p){if(me(d,void 0,"data"),s&&d.length<s)throw new Error('"ciphertext" expected length >= tagLength='+s);return c(a.decrypt.length,p),a.decrypt(d,p)}}}return Object.assign(r,e),r};function Ed(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(me(t,e,"output"),r&&!Or(t))throw new Error("invalid output, must be aligned");return t}function Td(e,t,r){Wo(e),Wo(t),Fb(r);let n=new Uint8Array(16),o=Er(n);return o.setBigUint64(0,BigInt(t),r),o.setBigUint64(8,BigInt(e),r),n}function Or(e){return e.byteOffset%4===0}function tr(e){return Uint8Array.from(me(e))}var rr=16,Od=new Uint8Array(16),wn=_t(Od),Hb=225,Kb=(e,t,r,n)=>{let o=n&1;return{s3:r<<31|n>>>1,s2:t<<31|r>>>1,s1:e<<31|t>>>1,s0:e>>>1^Hb<<24&-(o&1)}},Xo=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;var Jb=e=>e>64*1024?8:e>1024?4:2,pa=class{blockLen=rr;outputLen=rr;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(t,r){me(t,16,"key"),t=tr(t);let n=Er(t),o=n.getUint32(0,!1),s=n.getUint32(4,!1),i=n.getUint32(8,!1),a=n.getUint32(12,!1),c=[];for(let h=0;h<128;h++)c.push({s0:Xo(o),s1:Xo(s),s2:Xo(i),s3:Xo(a)}),{s0:o,s1:s,s2:i,s3:a}=Kb(o,s,i,a);let u=Jb(r||1024);if(![1,2,4,8].includes(u))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=u;let d=128/u,p=this.windowSize=2**u,f=[];for(let h=0;h<d;h++)for(let m=0;m<p;m++){let y=0,w=0,v=0,S=0;for(let T=0;T<u;T++){if(!(m>>>u-T-1&1))continue;let{s0:x,s1:$,s2:P,s3:O}=c[u*h+T];y^=x,w^=$,v^=P,S^=O}f.push({s0:y,s1:w,s2:v,s3:S})}this.t=f}_updateBlock(t,r,n,o){t^=this.s0,r^=this.s1,n^=this.s2,o^=this.s3;let{W:s,t:i,windowSize:a}=this,c=0,u=0,l=0,d=0,p=(1<<s)-1,f=0;for(let h of[t,r,n,o])for(let m=0;m<4;m++){let y=h>>>8*m&255;for(let w=8/s-1;w>=0;w--){let v=y>>>s*w&p,{s0:S,s1:T,s2:_,s3:x}=i[f*a+v];c^=S,u^=T,l^=_,d^=x,f+=1}}this.s0=c,this.s1=u,this.s2=l,this.s3=d}update(t){Go(this),me(t),t=tr(t);let r=_t(t),n=Math.floor(t.length/rr),o=t.length%rr;for(let s=0;s<n;s++)this._updateBlock(ue(r[s*4+0]),ue(r[s*4+1]),ue(r[s*4+2]),ue(r[s*4+3]));return o&&(Od.set(t.subarray(n*rr)),this._updateBlock(ue(wn[0]),ue(wn[1]),ue(wn[2]),ue(wn[3])),ut(wn)),this}destroy(){this.destroyed=!0;let{t}=this;for(let r of t)r.s0=0,r.s1=0,r.s2=0,r.s3=0}digestInto(t){Go(this),la(t,this),this.finished=!0;let{s0:r,s1:n,s2:o,s3:s}=this,i=_t(t);i[0]=r,i[1]=n,i[2]=o,i[3]=s,Tr||bn(i.subarray(0,rr/4))}digest(){let t=new Uint8Array(rr);return this.digestInto(t),this.destroy(),t}};var ha=fa(16,(e,t)=>new pa(e,t),e=>[e.length]);var ga=16,Wb=4,Yo=new Uint8Array(ga);var Gb=283;function Xb(e){if(![16,24,32].includes(e.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+e.length)}function ya(e){return e<<1^Gb&-(e>>7)}function Rd(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=ya(e);return r}var Yb=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=ya(n))e[r]=n;let t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return ut(e),t})();var Qb=e=>e<<24|e>>>8,ma=e=>e<<8|e>>>24;function ew(e,t){if(e.length!==256)throw new Error("wrong sbox length");let r=new Uint32Array(256).map((u,l)=>t(e[l])),n=r.map(ma),o=n.map(ma),s=o.map(ma),i=new Uint32Array(256*256),a=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let u=0;u<256;u++)for(let l=0;l<256;l++){let d=u*256+l;i[d]=r[u]^n[l],a[d]=o[u]^s[l],c[d]=e[u]<<8|e[l]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:o,T3:s,T01:i,T23:a}}var Cd=ew(Yb,e=>Rd(e,3)<<24|e<<16|e<<8|Rd(e,2));var tw=(()=>{let e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=ya(r))e[t]=r;return e})();function rw(e){me(e);let t=e.length;Xb(e);let{sbox2:r}=Cd,n=[];(!Tr||!Or(e))&&n.push(e=tr(e));let o=bn(_t(e)),s=o.length,i=c=>xn(r,c,c,c,c),a=new Uint32Array(t+28);a.set(o);for(let c=s;c<a.length;c++){let u=a[c-1];c%s===0?u=i(Qb(u))^tw[c/s-1]:s>6&&c%s===4&&(u=i(u)),a[c]=a[c-s]^u}return ut(...n),a}function Qo(e,t,r,n,o,s){return e[r<<8&65280|n>>>8&255]^t[o>>>8&65280|s>>>24&255]}function xn(e,t,r,n,o){return e[t&255|r&65280]|e[n>>>16&255|o>>>16&65280]<<16}function Ad(e,t,r,n,o){let{sbox2:s,T01:i,T23:a}=Cd,c=0;t^=e[c++],r^=e[c++],n^=e[c++],o^=e[c++];let u=e.length/4-2;for(let h=0;h<u;h++){let m=e[c++]^Qo(i,a,t,r,n,o),y=e[c++]^Qo(i,a,r,n,o,t),w=e[c++]^Qo(i,a,n,o,t,r),v=e[c++]^Qo(i,a,o,t,r,n);t=m,r=y,n=w,o=v}let l=e[c++]^xn(s,t,r,n,o),d=e[c++]^xn(s,r,n,o,t),p=e[c++]^xn(s,n,o,t,r),f=e[c++]^xn(s,o,t,r,n);return{s0:l,s1:d,s2:p,s3:f}}function es(e,t,r,n,o){me(r,ga,"nonce"),me(n),o=Ed(n.length,o);let s=r,i=_t(s),a=Er(s),c=_t(n),u=_t(o),l=t?0:12,d=n.length,p=a.getUint32(l,t);for(let h=0;h+4<=c.length;h+=4){let{s0:m,s1:y,s2:w,s3:v}=Ad(e,ue(i[0]),ue(i[1]),ue(i[2]),ue(i[3]));u[h+0]=c[h+0]^ue(m),u[h+1]=c[h+1]^ue(y),u[h+2]=c[h+2]^ue(w),u[h+3]=c[h+3]^ue(v),p=p+1>>>0,a.setUint32(l,p,t)}let f=ga*Math.floor(c.length/Wb);if(f<d){let{s0:h,s1:m,s2:y,s3:w}=Ad(e,ue(i[0]),ue(i[1]),ue(i[2]),ue(i[3])),v=new Uint32Array([h,m,y,w]);bn(v);let S=zd(v);for(let T=f,_=0;T<d;T++,_++)o[T]=n[T]^S[_];ut(v)}return o}function nw(e,t,r,n,o){let s=o?o.length:0,i=e.create(r,n.length+s);o&&i.update(o);let a=Td(8*n.length,8*s,t);i.update(n),i.update(a);let c=i.digest();return ut(a),c}var _a=Pd({blockSize:16,nonceLength:12,tagLength:16,withAAD:!0,varSizeNonce:!0},function(t,r,n){if(r.length<8)throw new Error("aes/gcm: invalid nonce length");let o=16;function s(a,c,u){let l=nw(ha,!1,a,u,n);for(let d=0;d<c.length;d++)l[d]^=c[d];return l}function i(){let a=rw(t),c=Yo.slice(),u=Yo.slice();if(es(a,!1,u,u,c),r.length===12)u.set(r);else{let d=Yo.slice();Er(d).setBigUint64(8,BigInt(r.length*8),!1);let f=ha.create(c).update(r).update(d);f.digestInto(u),f.destroy()}let l=es(a,!1,u,Yo);return{xk:a,authKey:c,counter:u,tagMask:l}}return{encrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=new Uint8Array(a.length+o),f=[c,u,l,d];Or(a)||f.push(a=tr(a)),es(c,!1,l,a,p.subarray(0,a.length));let h=s(u,d,p.subarray(0,p.length-o));return f.push(h),p.set(h,a.length),ut(...f),p},decrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=[c,u,d,l];Or(a)||p.push(a=tr(a));let f=a.subarray(0,-o),h=a.subarray(-o),m=s(u,d,f);if(p.push(m),!kd(m,h))throw ut(...p),new Error("aes-gcm: invalid tag");let y=es(c,!1,l,f);return ut(...p),y}}});function Id(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var ba=e=>e?`"${e}" `:"";function vn(e,t=""){if(typeof e!="number")throw new TypeError(ba(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(ba(t)+"expected integer >= 0, got "+e);return e}function It(e,t,r=""){if(Id(e)&&(t===void 0||e.length===t))return e;t!==void 0&&vn(t,"length");let n=Id(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=ba(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function $n(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(vn(e.outputLen),vn(e.blockLen),e.outputLen<1||e.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var ow=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},Nd=(e,t)=>{ow(e,t);let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function Rr(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function ts(e,t){It(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function lt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function rs(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ye(e,t){return e<<32-t|e>>>t}function sw(e,t,r="opts"){return Nd(e,"defaults"),t!==void 0&&Nd(t,r),Object.assign(Object.create(null),e,t)}function jd(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=sw({},t,"info");let r=(o,s)=>e(s).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}var Zd=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var ns=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if($n(t),It(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("expected Hash instance");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?t.create().update(r).digest():r);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),lt(o)}update(t){return Rr(this),this.iHash.update(t),this}digestInto(t){Rr(this),ts(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a,canXOF:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.canXOF=c,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Sn=(()=>{let e=((t,r,n)=>new ns(t,r).update(n).digest());return e.create=(t,r)=>new ns(t,r),e})();var zn=Uint8Array.of(0),iw=Uint8Array.of();function aw(e,t,r,n=32,o){$n(e),vn(n,"length"),It(t,void 0,"prk");let s=e.outputLen;if(t.length<s)throw new Error('"prk" must be at least HashLen octets');if(n>255*s)throw new Error("Length must be <= 255*HashLen");let i=Math.ceil(n/s);if(r===void 0?r=iw:It(r,void 0,"info"),!i)return o&<(t),new Uint8Array;let a=o&&i===1?t:new Uint8Array(i*s),{iHash:c,oHash:u}=Sn.create(e,t),l=o?t:new Uint8Array(s),d=i>1?o?.iHash||e.create():void 0;for(let f=0;f<i-1;f++){zn[0]=f+1;let h=c._cloneInto(d);f&&h.update(l),h.update(r).update(zn).digestInto(l),u._cloneInto(d).update(l).digestInto(l),a.set(l,s*f)}if(zn[0]=i,i>1&&c.update(l),c.update(r).update(zn).digestInto(l),u.update(l).digestInto(l),a.set(l,s*(i-1)),c.destroy(),u.destroy(),d?.destroy(),l!==a&<(l),lt(zn),n===a.length)return a;let p=a.slice(0,n);return lt(a),p}var wa=(e,t,r,n,o)=>{$n(e),r===void 0&&(r=new Uint8Array(e.outputLen));let s=Sn.create(e,r).update(t);return aw(e,s.digest(),n,o,s)};var cw=e=>e/2**32|0,uw=e=>e>>>0;function Dd(e,t,r,n){let o=cw(r),s=uw(r);e.setUint32(t,n?s:o,n),e.setUint32(t+4,n?o:s,n)}function Md(e,t,r){return e&t^~e&r}function Ld(e,t,r){return e&t^e&r^t&r}var os=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,o){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=rs(this.buffer)}update(t){Rr(this),It(t);let{view:r,buffer:n,blockLen:o}=this,s=t.length,i=!1;for(let a=0;a<s;){let c=Math.min(o-this.pos,s-a);if(c===o){let u=rs(t);for(;o<=s-a;a+=o)this.process(u,a);i=!0;continue}n.set(a===0&&c===s?t:t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(r,0),this.pos=0,i=!0)}return this.length+=t.length,i&&this.roundClean(),this}digestInto(t){Rr(this),ts(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,r.fill(0,i),this.padOffset>o-i&&(this.process(n,0),r.fill(0)),Dd(n,o-8,this.length*8,s),this.process(n,0),this.roundClean();let a=t===r?n:rs(t),c=this.outputLen,u=c/4,l=this.get();if(c%4||u>l.length)throw new Error("invalid outputLen");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneIntoMeta(t){let{buffer:r,length:n,finished:o,destroyed:s,pos:i}=this;return t.destroyed=s,t.finished=o,t.length=n,t.pos=i,i&&t.buffer.set(r),t}clone(){return this._cloneInto()}},Ud=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var lw=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nt=new Uint32Array(64),xa=class extends os{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,r){super(64,t,8,!1),this.A=r[0]|0,this.B=r[1]|0,this.C=r[2]|0,this.D=r[3]|0,this.E=r[4]|0,this.F=r[5]|0,this.G=r[6]|0,this.H=r[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,r,n,o,s,i,a,c]}set(t,r,n,o,s,i,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,r){for(let d=0;d<16;d++,r+=4)Nt[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let p=Nt[d-15],f=Nt[d-2],h=Ye(p,7)^Ye(p,18)^p>>>3,m=Ye(f,17)^Ye(f,19)^f>>>10;Nt[d]=m+Nt[d-7]+h+Nt[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){let p=Ye(a,6)^Ye(a,11)^Ye(a,25),f=l+p+Md(a,c,u)+lw[d]+Nt[d]|0,m=(Ye(n,2)^Ye(n,13)^Ye(n,22))+Ld(n,o,s)|0;l=u,u=c,c=a,a=i+f|0,i=s,s=o,o=n,n=f+m|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,o,s,i,a,c,u,l)}roundClean(){lt(Nt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),lt(this.buffer)}},va=class extends xa{constructor(){super(32,Ud)}};var ss=jd(()=>new va,Zd(1));var kn=new TextEncoder,dw=new TextDecoder,fw="ape1",qd=/^ape1\.([A-Za-z0-9_-]{16})\.([A-Za-z0-9_-]+)$/,pw=/^[A-Za-z0-9_-]{43}$/,hw=/^jb_live_[A-Za-z0-9]{40}$/;function is(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function $a(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)),r=new Uint8Array(new ArrayBuffer(t.length));for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Fd(){return is(globalThis.crypto.getRandomValues(new Uint8Array(32)))}var Sa=e=>pw.test(e),Bd=e=>typeof e=="string"&&qd.test(e);function Vd(e){let t=e.trim();if(Sa(t))return{token:null,key:t};let[r,n,...o]=t.split(".");if(!hw.test(r)||o.length||n!==void 0&&!Sa(n))throw new Error("Not a valid Jotbus token or connection string");return{token:r,key:n??null}}var za=(e,t)=>`${e}.${t}`;async function Pn(e){if(!Sa(e))throw new Error("Invalid workspace key");let t=$a(e),r=new Uint8Array(32),n=wa(ss,t,r,kn.encode("agentpad/v1/enc"),32),o=wa(ss,t,r,kn.encode("agentpad/v1/check"),32),s=is(Sn(ss,o,kn.encode("agentpad/v1/key-check"))),i=a=>kn.encode(`agentpad/v1/${a}`);return{check:s,async encrypt(a,c){let u=globalThis.crypto.getRandomValues(new Uint8Array(12)),l=_a(n,u,i(a)).encrypt(kn.encode(JSON.stringify(c)));return`${fw}.${is(u)}.${is(l)}`},async decrypt(a,c){let u=qd.exec(c);if(!u)throw new Error("Not an encrypted message");let l=_a(n,$a(u[1]),i(a)).decrypt($a(u[2])),d=JSON.parse(dw.decode(l));if(typeof d?.c!="string")throw new Error("Malformed message");return d}}}var mw=/jb1_([A-Za-z0-9]{24})\.([A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/,Hd=(e,t)=>`${e}.${t}`;function Kd(e){let t=mw.exec(e.trim());return t?{invite:`jb1_${t[1]}`,key:t[2]}:null}var nr="0.3.0",or="https://app.jotbus.com",as=`${or}/mcp`;var _w=!!(process.stdin.isTTY&&process.stdout.isTTY),Ar=e=>t=>process.stdout.isTTY&&!process.env.NO_COLOR?`\x1B[${e}m${t}\x1B[0m`:t,En=Ar("1"),dt=Ar("2"),ka=Ar("32"),Wd=Ar("36"),bw=Ar("33"),ge=(e="")=>process.stdout.write(`${e}
|
|
11
|
-
`);function
|
|
12
|
-
`),process.exit(1)}async function
|
|
13
|
-
${s.manual(t,r)}`)}return o}function ef(e){ge(),ge(En("Then tell your agent:")),ge(` ${Wd('"Use Jotbus to collaborate."')}`),e.includes("Claude Code")?ge(dt(" (Start a new Claude Code session so it picks up the new connection.)")):e.length&&ge(dt(" (Restart your agent so it picks up the new connection.)"))}async function Pa(e){let t=Fd(),r=await Pn(t),n=await Gd(e,"workspaces",{key_check:r.check}),o=Hd(n.invite,t);ge(`${ka("\u2713")} Created temporary workspace ${En(n.name)} ${dt(`(end-to-end encrypted, expires in ${Xd(n.expires_at)} minutes at ${Yd(n.expires_at)})`)}`);let s=await Qd(e,za(n.token,t));ge(),ge(En("Connect another machine or person:"));let i=e.origin===or?"":` --origin ${e.origin}`;ge(` ${Wd(`npx jotbus@latest join ${o}${i}`)}`),ge(dt(` or share this link: ${e.origin}/join#${o}`)),ge(dt(" No account needed. Up to 3 connected clients. The invite includes the encryption key, so share it privately.")),ef(s)}async function tf(e,t){let r=t?Kd(t):null;r||cs("Usage: npx jotbus join <invite> (the jb1_\u2026 invite or join link you were sent)");let n=await Pn(r.key),o=await Gd(e,"join",{invite:r.invite});o.key_check!==n.check&&cs("This invite's encryption key doesn't match the workspace. Ask for a fresh invite."),ge(`${ka("\u2713")} Joined ${En(o.name)} ${dt(`(end-to-end encrypted, expires in ${Xd(o.expires_at)} minutes at ${Yd(o.expires_at)})`)}`);let s=await Qd(e,za(o.token,r.key));ef(s)}import{webcrypto as mO}from"node:crypto";import{hostname as gO}from"node:os";var j={};aa(j,{BIGINT_FORMAT_RANGES:()=>fs,CONSTANT_CATCH:()=>hf,Class:()=>Oa,NUMBER_FORMAT_RANGES:()=>On,aborted:()=>Qe,allowsEval:()=>Na,assert:()=>kw,assertEqual:()=>vw,assertIs:()=>Sw,assertNever:()=>zw,assertNotEqual:()=>$w,assignProp:()=>qe,attachSchema:()=>hs,base64ToUint8Array:()=>ff,base64urlToUint8Array:()=>Vw,cached:()=>jr,captureStackTrace:()=>ls,cleanEnum:()=>Bw,cleanRegex:()=>Tn,clone:()=>Ve,cloneDef:()=>Tw,codePointLength:()=>Rn,constantCatch:()=>mf,createTransparentProxy:()=>Nw,defineLazy:()=>of,defineLazyInternal:()=>H,derived:()=>Ww,esc:()=>Ca,escapeRegex:()=>xt,explicitlyAborted:()=>Da,extend:()=>Dw,finalizeIssue:()=>et,floatSafeRemainder:()=>Aa,getElementAtPath:()=>Ow,getEnumValues:()=>Ir,getLengthableOrigin:()=>An,getParsedType:()=>Iw,getSizableOrigin:()=>df,hexToUint8Array:()=>Kw,hide:()=>ms,installLazyProp:()=>Qw,isObject:()=>ar,isPlainObject:()=>Dt,issue:()=>Dr,joinValues:()=>us,jsonStringifyReplacer:()=>Nr,members:()=>La,merge:()=>Lw,mergeDefs:()=>wt,normalizeParams:()=>I,nullish:()=>Ra,numKeys:()=>Cw,objectClone:()=>Pw,omit:()=>Zw,optionalKeys:()=>Za,own:()=>Zt,parsedType:()=>Ma,partial:()=>Uw,pick:()=>jw,prefixIssues:()=>vt,primitiveTypes:()=>uf,promiseAllObject:()=>Rw,propertyKeyTypes:()=>ja,randomString:()=>Aw,rawShape:()=>Zr,required:()=>qw,safeExtend:()=>Mw,shallowClone:()=>cf,slugify:()=>Ia,stringifyPrimitive:()=>ds,toZod:()=>nf,uint8ArrayToBase64:()=>pf,uint8ArrayToBase64url:()=>Hw,uint8ArrayToHex:()=>Jw,unwrapMessage:()=>Cr});function vw(e){return e}function $w(e){return e}function nf(){return e=>e}function Sw(e){}function zw(e){throw new Error("Unexpected value in exhaustive check")}function kw(e){}function Ir(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function us(e,t="|"){return e.map(r=>ds(r)).join(t)}function Nr(e,t){return typeof t=="bigint"?t.toString():t}var Ta=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 jr(e){return new Ta(e)}function Ra(e){return e==null}function Tn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Aa(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var rf=Symbol("evaluating");function of(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==rf)return n===void 0&&(n=rf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Pw(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function qe(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Zr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function bt(e){return Zr(e._zod.def)??e._zod.def.shape}function sf(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return qe(this,t,n),n},enumerable:!0,configurable:!0})}function af(e,t,r){t in e?qe(e,t,r):e[t]=r}function ir(e,t,r,n){let o=bt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?sf(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a}):af(e,s,n?n(i.value,s):i.value))}}function Ew(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?sf(e,r,()=>t[r]):af(e,r,n.value))}}function wt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Tw(e){return wt(e._zod.def)}function Ow(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Rw(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Aw(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ca(e){return JSON.stringify(e)}function Ia(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ls="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Na=jr(()=>{if(Ie.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Dt(e){if(ar(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ar(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cf(e){return Dt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Cw(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Iw=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}`)}},ja=new Set(["string","number","symbol"]),uf=new Set(["string","number","bigint","boolean","symbol","undefined"]);function xt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ve(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(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 Nw(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ds(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Za(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var On={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]},fs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function jw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return ir(s,e,ps(e,t)),Ve(e,wt(r,{shape:s,checks:[]}))}function ps(e,t){let r=bt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Zw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(ps(e,t)),i={};return ir(i,e,Reflect.ownKeys(bt(e)).filter(a=>!s.has(a))),Ve(e,wt(r,{shape:i,checks:[]}))}function Dw(e,t){if(!Dt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=bt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ve(e,wt(e._zod.def,{shape:lf(e,t)}))}function lf(e,t){let r={};return ir(r,e,Reflect.ownKeys(bt(e))),Ew(r,t),r}function Mw(e,t){if(!Dt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ve(e,wt(e._zod.def,{shape:lf(e,t)}))}function Lw(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={};ir(r,e,Reflect.ownKeys(bt(e))),ir(r,t,Reflect.ownKeys(bt(t)));let n=wt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ve(e,n)}function Uw(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(ps(t,r)):void 0,c={};return ir(c,t,Reflect.ownKeys(bt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),Ve(t,wt(t._zod.def,{shape:c,checks:[]}))}function qw(e,t,r){let n=r?new Set(ps(t,r)):void 0,o={};return ir(o,t,Reflect.ownKeys(bt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Ve(t,wt(t._zod.def,{shape:o}))}function Qe(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 Da(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 vt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Cr(e){return typeof e=="string"?e:e?.message}function hs(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function et(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.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:Cr(e.inst?._zod.def?.error?.(e))??Cr(s?.(e))??Cr(t?.error?.(e))??Cr(r.customError?.(e))??Cr(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function df(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Fw=/[\uD800-\uDBFF]/;function Rn(e){let t=e.length;if(!Fw.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function An(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ma(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 Dr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Bw(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function ff(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function pf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Vw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return ff(t+r)}function Hw(e){return pf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Kw(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 n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Jw(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Oa=class{constructor(...t){}};function La(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Gw(e,r,n.value)}}function Zt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ms(e,t,r){return Zt(e,t,r,!1)}function Ww(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Zt(this,r,n(this))},set(o){Zt(this,r,o)}})}return t}function Gw(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Zt(this,t,r.bind(this))},set(n){Zt(this,t,n)}})}function Xw(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ea,jt=!1,Yw={configurable:!0,get(){jt=!0}};function H(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ea!==e._zod){Ea=void 0;return}Ea=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Yw);let o=jt;jt=!1;try{let s=r(this);return jt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),jt=jt||o,s}catch(s){throw delete this[t],jt=jt||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Qw(e,t,r,n){let o=Xw(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,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:n,value:s})}})}var hf="~constantCatch";function mf(e){let t=()=>e;return t[hf]=!0,t}var gf,qa=Object.freeze({status:"aborted"}),Ua={value:void 0,enumerable:!1},yf="captureStackTrace"in Error?Error:null;function ex(e){let t=yf;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return yf=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function s(p){this.def=p,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(p,f){if(p._zod){if(p._zod.traits.has(e))return}else{Ua.value=new s(f);try{Object.defineProperty(p,"_zod",Ua)}finally{Ua.value=void 0}}if(p._zod.traits.add(e),t(p,f),a){let m=Object.getPrototypeOf(p),y=p._zod.constr.prototype,w=m;for(;w&&w!==y;)w=Object.getPrototypeOf(w);let v=w??m;a.has(v)||(a.add(v),La(v,i))}let h=d.prototype;for(let m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in p||(p[m]=h[m].bind(p)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(p){let f=n?.Parent?ex(l):this;c(f,p);let h=f._zod.deferred;if(h){for(let y of h)y();f._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(f),f}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var tt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(gf=globalThis).__zod_globalConfig??(gf.__zod_globalConfig={});var Ie=globalThis.__zod_globalConfig;function Ne(e){return e&&Object.assign(Ie,e),Ie}function tx(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Nr,2)),e.message}function rx(e){this._zod.message=e}var nx={get:tx,set:rx,enumerable:!0,configurable:!0},Ba={value:void 0,enumerable:!1},_f=new WeakSet([Object.prototype,Error.prototype]),bf=(e,t)=>{e.name="$ZodError",Ba.value=t,Object.defineProperty(e,"issues",Ba),Ba.value=void 0,Object.defineProperty(e,"message",nx);let r=Object.getPrototypeOf(e);_f.has(r)||(_f.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},wf=b("$ZodError",bf),xf=b("$ZodError",bf,void 0,{Parent:Error});function ox(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 Va(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ox(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ha(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];d&&p._errors.push(t(i)),c=p,u++}}}};return n(e),r}function gs(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ys=e=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new tt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>et(u,i,Ne())));throw ls(c,s?.callee??t),c}return a.value};return t};var _s=e=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>et(u,i,Ne())));throw ls(c,s?.callee??t),c}return a.value};return t};var Cn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new tt;return s.issues.length?vf(e,s.issues,o):{success:!0,data:s.value}},Ka=Cn(xf);function vf(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>et(o,r,Ne()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var bs=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?vf(e,s.issues,o):{success:!0,data:s.value}};var ix=Symbol.for("zod.compile.invalid"),ax=Symbol.for("zod.compile.fallback"),ws=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ix)return!0;if(n.definite===!0&&r===void 0)return!1}return cx(e,t,r)});function cx(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o?(n[ax]=!0,s=o({value:t,issues:[]},n)):s=e._zod.run({value:t,issues:[]},n),s instanceof Promise)throw new tt;return s.issues.length===0}var xs=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},$f=e=>{let t=ys(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,gs(r,i))};return r};var Sf=e=>{let t=ys(e),r=(n,o,s,i)=>t(n,o,s,gs(r,i));return r};var zf=e=>{let t=_s(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,gs(r,i))};return r};var kf=e=>{let t=_s(e),r=async(n,o,s,i)=>await t(n,o,s,gs(r,i));return r};var Pf=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Cn(e)(t,r,o)};var Ef=e=>(t,r,n)=>Cn(e)(t,r,n);var Tf=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return bs(e)(t,r,o)};var Of=e=>async(t,r,n)=>bs(e)(t,r,n);var Rf=/^[cC][0-9a-z]{6,}$/,Af=/^[0-9a-z]+$/,Cf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,If=/^[0-9a-vA-V]{20}$/,Nf=/^[A-Za-z0-9]{27}$/,jf=/^[a-zA-Z0-9_-]{21}$/;function Zf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Df=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Mf=/^([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})$/,Wa=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 Lf=/^(?:[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 ux="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Uf(){return new RegExp(ux,"u")}var qf=/^(?:(?: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])$/,Ff=/^(([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 Bf=/^((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])$/,Vf=/^(([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])$/,Hf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Kf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Jf=/^https?$/,Wf=/^\+[1-9]\d{6,14}$/;var Gf="(?:(?:\\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 lx(e){return new RegExp(`^${e}$`)}var Xf=lx(Gf);function Ja(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 Yf(e){return new RegExp(`^${Ja(e)}$`)}function Qf(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ja({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ja({precision:e.precision})}`:r;return new RegExp(`^${Gf}T(?:${n})$`)}var ep=/^[\s\S]{0,}$/;var tp=/^-?\d+n?$/,Ga=/^-?\d+$/,In=/^-?\d+(?:\.\d+)?$/,rp=/^(?:true|false)$/i,np=/^null$/i;var op=/^[^A-Z]*$/,sp=/^[^a-z]*$/;var _e=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Xa=e=>{let t=e.value;return!Ra(t)&&t.length!==void 0},vs={number:"number",bigint:"bigint",object:"date"},Ya=b("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let r=vs[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:vs[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qa=b("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let r=vs[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:vs[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ip=b("$ZodCheckMultipleOf",(e,t)=>{_e.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):Aa(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})}}),ap=b("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=On[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,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:n,inclusive:!0,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:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var cp=b("$ZodCheckMaxLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Xa),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>t.maximum?Rn(o):s)<=t.maximum)return;let a=An(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),up=b("$ZodCheckMinLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Xa),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?Rn(o):s)>=t.minimum)return;let a=An(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lp=b("$ZodCheckLengthEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Xa),e._zod.check=n=>{let o=n.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?Rn(o):s;if(i===t.length)return;let a=An(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nn=b("$ZodCheckStringFormat",(e,t)=>{var r,n;_e.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),dp=b("$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})}}),fp=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=op),Nn.init(e,t)}),pp=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=sp),Nn.init(e,t)}),hp=b("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let r=xt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),mp=b("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`^${xt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gp=b("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`.*${xt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var yp=b("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var $s=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 n=t.split(`
|
|
10
|
+
deps: ${r}}`};var oE={keyword:"dependencies",type:"object",schemaType:"object",error:gt.error,code(e){let[t,r]=sE(e);g0(e,t),y0(e,r)}};function sE({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function g0(e,t=e.schema){let{gen:r,data:n,it:o}=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,Io.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Io.checkReportMissingProp)(e,u)}):(r.if((0,Dl._)`${c} && (${(0,Io.checkMissingProp)(e,a,s)})`),(0,Io.reportMissingProp)(e,s),r.else())}}gt.validatePropertyDeps=g0;function y0(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,nE.alwaysValidSchema)(s,t[a])||(r.if((0,Io.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}gt.validateSchemaDeps=y0;gt.default=oE});var w0=P(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});var b0=U(),iE=K(),aE={message:"property name must be valid",params:({params:e})=>(0,b0._)`{propertyName: ${e.propertyName}}`},cE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:aE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,iE.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,b0.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Ml.default=cE});var Ul=P(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});var Ui=Qe(),lt=U(),uE=Rt(),qi=K(),lE={message:"must NOT have additional properties",params:({params:e})=>(0,lt._)`{additionalProperty: ${e.additionalProperty}}`},dE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,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,qi.alwaysValidSchema)(i,r))return;let u=(0,Ui.allSchemaProperties)(n.properties),l=(0,Ui.allSchemaProperties)(n.patternProperties);d(),e.ok((0,lt._)`${s} === ${uE.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(p(y),()=>h(y))})}function p(y){let _;if(u.length>8){let v=(0,qi.schemaRefOrVal)(i,n.properties,"properties");_=(0,Ui.isOwnProperty)(t,v,y)}else u.length?_=(0,lt.or)(...u.map(v=>(0,lt._)`${y} === ${v}`)):_=lt.nil;return l.length&&(_=(0,lt.or)(_,...l.map(v=>(0,lt._)`${(0,Ui.usePattern)(e,v)}.test(${y})`))),(0,lt.not)(_)}function f(y){t.code((0,lt._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,qi.alwaysValidSchema)(i,r)){let _=t.name("valid");c.removeAdditional==="failing"?(m(y,_,!1),t.if((0,lt.not)(_),()=>{e.reset(),f(y)})):(m(y,_),a||t.if((0,lt.not)(_),()=>t.break()))}}function m(y,_,v){let $={keyword:"additionalProperties",dataProp:y,dataPropType:qi.Type.Str};v===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,_)}}};Ll.default=dE});var $0=P(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});var fE=bo(),x0=Qe(),ql=K(),v0=Ul(),pE={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&v0.default.code(new fE.KeywordCxt(s,v0.default,"additionalProperties"));let i=(0,x0.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ql.mergeEvaluated.props(t,(0,ql.toHash)(i),s.props));let a=i.filter(d=>!(0,ql.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,x0.propertyInData)(t,o,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Fl.default=pE});var P0=P(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});var S0=Qe(),Fi=U(),z0=K(),k0=K(),hE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,S0.allSchemaProperties)(r),c=a.filter(m=>(0,z0.alwaysValidSchema)(s,r[m]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof Fi.Name)&&(s.props=(0,k0.evaluatedPropsToName)(t,s.props));let{props:d}=s;p();function p(){for(let m of a)u&&f(m),s.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function f(m){for(let y in u)new RegExp(m).test(y)&&(0,z0.checkStrictMode)(s,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,y=>{t.if((0,Fi._)`${(0,S0.usePattern)(e,m)}.test(${y})`,()=>{let _=c.includes(m);_||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:k0.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Fi._)`${d}[${y}]`,!0):!_&&!s.allErrors&&t.if((0,Fi.not)(l),()=>t.break())})})}}};Bl.default=hE});var E0=P(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});var mE=K(),gE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,mE.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Vl.default=gE});var T0=P(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});var yE=Qe(),_E={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yE.validateUnion,error:{message:"must match a schema in anyOf"}};Hl.default=_E});var O0=P(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});var Bi=U(),bE=K(),wE={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Bi._)`{passingSchemas: ${e.passing}}`},xE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:wE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.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(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let p;(0,bE.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Bi._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Bi._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),p&&e.mergeEvaluated(p,Bi.Name)})})}}};Kl.default=xE});var R0=P(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});var vE=K(),$E={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,vE.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Jl.default=$E});var I0=P(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var Vi=U(),C0=K(),SE={message:({params:e})=>(0,Vi.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Vi._)`{failingKeyword: ${e.ifClause}}`},zE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:SE,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,C0.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=A0(n,"then"),s=A0(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Vi.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(p,i),d?t.assign(d,(0,Vi._)`${l}`):e.setParams({ifClause:l})}}}};function A0(e,t){let r=e.schema[t];return r!==void 0&&!(0,C0.alwaysValidSchema)(e,r)}Wl.default=zE});var N0=P(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});var kE=K(),PE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,kE.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Gl.default=PE});var j0=P(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});var EE=Cl(),TE=f0(),OE=Il(),RE=h0(),AE=m0(),CE=_0(),IE=w0(),NE=Ul(),jE=$0(),ZE=P0(),DE=E0(),ME=T0(),LE=O0(),UE=R0(),qE=I0(),FE=N0();function BE(e=!1){let t=[DE.default,ME.default,LE.default,UE.default,qE.default,FE.default,IE.default,NE.default,CE.default,jE.default,ZE.default];return e?t.push(TE.default,RE.default):t.push(EE.default,OE.default),t.push(AE.default),t}Xl.default=BE});var Z0=P(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var me=U(),VE={message:({schemaCode:e})=>(0,me.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,me._)`{format: ${e}}`},HE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:VE,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,me._)`${h}[${i}]`),y=r.let("fType"),_=r.let("format");r.if((0,me._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,me._)`${m}.type || "string"`).assign(_,(0,me._)`${m}.validate`),()=>r.assign(y,(0,me._)`"string"`).assign(_,m)),e.fail$data((0,me.or)(v(),$()));function v(){return c.strictSchema===!1?me.nil:(0,me._)`${i} && !${_}`}function $(){let C=l.$async?(0,me._)`(${m}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,me._)`${_}(${n})`,w=(0,me._)`(typeof ${_} == "function" ? ${C} : ${_}.test(${n}))`;return(0,me._)`${_} && ${_} !== true && ${y} === ${t} && !${w}`}}function f(){let h=d.formats[s];if(!h){v();return}if(h===!0)return;let[m,y,_]=$(h);m===t&&e.pass(C());function v(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function $(w){let x=w instanceof RegExp?(0,me.regexpCode)(w):c.code.formats?(0,me._)`${c.code.formats}${(0,me.getProperty)(s)}`:void 0,E=r.scopeValue("formats",{key:s,ref:w,code:x});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,me._)`${E}.validate`]:["string",w,E]}function C(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,me._)`await ${_}(${n})`}return typeof y=="function"?(0,me._)`${_}(${n})`:(0,me._)`${_}.test(${n})`}}}};Yl.default=HE});var D0=P(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var KE=Z0(),JE=[KE.default];Ql.default=JE});var M0=P(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.contentVocabulary=pn.metadataVocabulary=void 0;pn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];pn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var U0=P(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});var WE=J_(),GE=c0(),XE=j0(),YE=D0(),L0=M0(),QE=[WE.default,GE.default,(0,XE.default)(),YE.default,L0.metadataVocabulary,L0.contentVocabulary];ed.default=QE});var F0=P(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.DiscrError=void 0;var q0;(function(e){e.Tag="tag",e.Mapping="mapping"})(q0||(Hi.DiscrError=q0={}))});var V0=P(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var hn=U(),td=F0(),B0=Pi(),eT=wo(),tT=K(),rT={message:({params:{discrError:e,tagName:t}})=>e===td.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,hn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},nT={keyword:"discriminator",type:"object",schemaType:"object",error:rT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,hn._)`${r}${(0,hn.getProperty)(a)}`);t.if((0,hn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:td.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=p();t.if(!1);for(let h in f)t.elseIf((0,hn._)`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:td.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(m,hn.Name),h}function p(){var f;let h={},m=_(o),y=!0;for(let C=0;C<i.length;C++){let w=i[C];if(w?.$ref&&!(0,tT.schemaHasRulesButRef)(w,s.self.RULES)){let E=w.$ref;if(w=B0.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,E),w instanceof B0.SchemaEnv&&(w=w.schema),w===void 0)throw new eT.default(s.opts.uriResolver,s.baseId,E)}let x=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(m||_(w)),v(x,C)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function _({required:C}){return Array.isArray(C)&&C.includes(a)}function v(C,w){if(C.const)$(C.const,w);else if(C.enum)for(let x of C.enum)$(x,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function $(C,w){if(typeof C!="string"||C in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[C]=w}}}};rd.default=nT});var H0=P((W4,oT)=>{oT.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 od=P((ce,nd)=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.MissingRefError=ce.ValidationError=ce.CodeGen=ce.Name=ce.nil=ce.stringify=ce.str=ce._=ce.KeywordCxt=ce.Ajv=void 0;var sT=q_(),iT=U0(),aT=V0(),K0=H0(),cT=["/properties"],Ki="http://json-schema.org/draft-07/schema",mn=class extends sT.default{_addVocabularies(){super._addVocabularies(),iT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(aT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(K0,cT):K0;this.addMetaSchema(t,Ki,!1),this.refs["http://json-schema.org/schema"]=Ki}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ki)?Ki:void 0)}};ce.Ajv=mn;nd.exports=ce=mn;nd.exports.Ajv=mn;Object.defineProperty(ce,"__esModule",{value:!0});ce.default=mn;var uT=bo();Object.defineProperty(ce,"KeywordCxt",{enumerable:!0,get:function(){return uT.KeywordCxt}});var gn=U();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return gn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return gn.str}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return gn.stringify}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return gn.nil}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return gn.Name}});Object.defineProperty(ce,"CodeGen",{enumerable:!0,get:function(){return gn.CodeGen}});var lT=zi();Object.defineProperty(ce,"ValidationError",{enumerable:!0,get:function(){return lT.default}});var dT=wo();Object.defineProperty(ce,"MissingRefError",{enumerable:!0,get:function(){return dT.default}})});var tb=P(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.formatNames=_t.fastFormats=_t.fullFormats=void 0;function yt(e,t){return{validate:e,compare:t}}_t.fullFormats={date:yt(X0,cd),time:yt(id(!0),ud),"date-time":yt(J0(!0),Q0),"iso-time":yt(id(),Y0),"iso-date-time":yt(J0(),eb),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:yT,"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:ST,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:_T,int32:{type:"number",validate:xT},int64:{type:"number",validate:vT},float:{type:"number",validate:G0},double:{type:"number",validate:G0},password:!0,binary:!0};_t.fastFormats={..._t.fullFormats,date:yt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,cd),time:yt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ud),"date-time":yt(/^\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,Q0),"iso-time":yt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Y0),"iso-date-time":yt(/^\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,eb),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};_t.formatNames=Object.keys(_t.fullFormats);function fT(e){return e%4===0&&(e%100!==0||e%400===0)}var pT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,hT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function X0(e){let t=pT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&fT(r)?29:hT[n])}function cd(e,t){if(e&&t)return e>t?1:e<t?-1:0}var sd=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function id(e){return function(r){let n=sd.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function ud(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Y0(e,t){if(!(e&&t))return;let r=sd.exec(e),n=sd.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var ad=/t|\s/i;function J0(e){let t=id(e);return function(n){let o=n.split(ad);return o.length===2&&X0(o[0])&&t(o[1])}}function Q0(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function eb(e,t){if(!(e&&t))return;let[r,n]=e.split(ad),[o,s]=t.split(ad),i=cd(r,o);if(i!==void 0)return i||ud(n,s)}var mT=/\/|:/,gT=/^(?:[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 yT(e){return mT.test(e)&&gT.test(e)}var W0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _T(e){return W0.lastIndex=0,W0.test(e)}var bT=-(2**31),wT=2**31-1;function xT(e){return Number.isInteger(e)&&e<=wT&&e>=bT}function vT(e){return Number.isInteger(e)}function G0(){return!0}var $T=/[^\\]\\Z/;function ST(e){if($T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var rb=P(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.formatLimitDefinition=void 0;var zT=od(),dt=U(),er=dt.operators,Ji={formatMaximum:{okStr:"<=",ok:er.LTE,fail:er.GT},formatMinimum:{okStr:">=",ok:er.GTE,fail:er.LT},formatExclusiveMaximum:{okStr:"<",ok:er.LT,fail:er.GTE},formatExclusiveMinimum:{okStr:">",ok:er.GT,fail:er.LTE}},kT={message:({keyword:e,schemaCode:t})=>(0,dt.str)`should be ${Ji[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,dt._)`{comparison: ${Ji[e].okStr}, limit: ${t}}`};yn.formatLimitDefinition={keyword:Object.keys(Ji),type:"string",schemaType:"string",$data:!0,error:kT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new zT.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,dt._)`${p}[${c.schemaCode}]`);e.fail$data((0,dt.or)((0,dt._)`typeof ${f} != "object"`,(0,dt._)`${f} instanceof RegExp`,(0,dt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,dt._)`${i.code.formats}${(0,dt.getProperty)(p)}`:void 0});e.fail$data(d(h))}function d(p){return(0,dt._)`${p}.compare(${r}, ${n}) ${Ji[o].fail} 0`}},dependencies:["format"]};var PT=e=>(e.addKeyword(yn.formatLimitDefinition),e);yn.default=PT});var ib=P((No,sb)=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});var _n=tb(),ET=rb(),ld=U(),nb=new ld.Name("fullFormats"),TT=new ld.Name("fastFormats"),dd=(e,t={keywords:!0})=>{if(Array.isArray(t))return ob(e,t,_n.fullFormats,nb),e;let[r,n]=t.mode==="fast"?[_n.fastFormats,TT]:[_n.fullFormats,nb],o=t.formats||_n.formatNames;return ob(e,o,r,n),t.keywords&&(0,ET.default)(e),e};dd.get=(e,t="full")=>{let n=(t==="fast"?_n.fastFormats:_n.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function ob(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,ld._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}sb.exports=No=dd;Object.defineProperty(No,"__esModule",{value:!0});No.default=dd});var fb=P(fd=>{"use strict";var ub=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,AT=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,lb=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,CT=/\\([\u000b\u0020-\u00ff])/g,IT=/([\\"])/g,db=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;fd.format=NT;fd.parse=jT;function NT(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!db.test(r))throw new TypeError("invalid type");var n=r;if(t&&typeof t=="object")for(var o,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(o=s[i],!lb.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+DT(t[o])}return n}function jT(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?ZT(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!db.test(n))throw new TypeError("invalid media type");var o=new MT(n.toLowerCase());if(r!==-1){var s,i,a;for(ub.lastIndex=r;i=ub.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(CT,"$1"))),o.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}function ZT(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 DT(e){var t=String(e);if(lb.test(t))return t;if(t.length>0&&!AT.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(IT,"\\$1")+'"'}function MT(e){this.parameters=Object.create(null),this.type=e}});import{webcrypto as xO}from"node:crypto";import{parseArgs as vO}from"node:util";import{spawnSync as bw}from"node:child_process";import{createInterface as ww}from"node:readline/promises";function da(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Go=e=>e?`"${e}" `:"";function Hb(e,t=""){if(typeof e!="boolean")throw new TypeError(Go(t)+"expected boolean, got type="+typeof e);return e}function Xo(e,t=""){if(typeof e!="number")throw new TypeError(Go(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Go(t)+"expected integer >= 0, got "+e);return e}function we(e,t,r=""){if(da(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Xo(t,"length");let n=da(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=Go(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function Yo(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Kb(e,t){we(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function fa(e,t){if(Kb(e,t),!Rr(e))throw new Error("invalid output, must be aligned")}function Ed(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function bt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ft(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Tr(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Or=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function pa(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}var fe=Or?e=>e:e=>pa(e)>>>0;function Jb(e){for(let t=0;t<e.length;t++)e[t]=pa(e[t]);return e}var vn=Or?e=>e:Jb;function Td(e,t){if(e=we(e),t=we(t),e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function ha(e,t,r){let n=t,o=r||(()=>[]),s=(a,c)=>n(c,...o(a)).update(a).digest(),i=n(new Uint8Array(e),...o(new Uint8Array(0)));return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.create=(a,...c)=>n(a,...c),s}var Od=(e,t)=>{function r(n,...o){if(we(n,void 0,"key"),e.nonceLength!==void 0){let d=o[0];we(d,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let s=e.tagLength,i=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let d=i;d<o.length;d++)if(da(o[d]))throw new Error("AAD not supported")}e.withAAD&&o[i]!==void 0&&we(o[i],void 0,"AAD");let a=t(n,...o),c=(d,p)=>{if(p!==void 0){if(d!==2)throw new Error("cipher output not supported");we(p,void 0,"output")}},u=!1;return{encrypt(d,p){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,we(d,void 0,"data"),c(a.encrypt.length,p),a.encrypt(d,p)},decrypt(d,p){if(we(d,void 0,"data"),s&&d.length<s)throw new Error('"ciphertext" expected length >= tagLength='+s);return c(a.decrypt.length,p),a.decrypt(d,p)}}}return Object.assign(r,e),r};function Rd(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(we(t,e,"output"),r&&!Rr(t))throw new Error("invalid output, must be aligned");return t}function Ad(e,t,r){Xo(e),Xo(t),Hb(r);let n=new Uint8Array(16),o=Tr(n);return o.setBigUint64(0,BigInt(t),r),o.setBigUint64(8,BigInt(e),r),n}function Rr(e){return e.byteOffset%4===0}function rr(e){return Uint8Array.from(we(e))}var nr=16,Cd=new Uint8Array(16),$n=bt(Cd),Wb=225,Gb=(e,t,r,n)=>{let o=n&1;return{s3:r<<31|n>>>1,s2:t<<31|r>>>1,s1:e<<31|t>>>1,s0:e>>>1^Wb<<24&-(o&1)}},Qo=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;var Xb=e=>e>64*1024?8:e>1024?4:2,ma=class{blockLen=nr;outputLen=nr;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(t,r){we(t,16,"key"),t=rr(t);let n=Tr(t),o=n.getUint32(0,!1),s=n.getUint32(4,!1),i=n.getUint32(8,!1),a=n.getUint32(12,!1),c=[];for(let h=0;h<128;h++)c.push({s0:Qo(o),s1:Qo(s),s2:Qo(i),s3:Qo(a)}),{s0:o,s1:s,s2:i,s3:a}=Gb(o,s,i,a);let u=Xb(r||1024);if(![1,2,4,8].includes(u))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=u;let d=128/u,p=this.windowSize=2**u,f=[];for(let h=0;h<d;h++)for(let m=0;m<p;m++){let y=0,_=0,v=0,$=0;for(let C=0;C<u;C++){if(!(m>>>u-C-1&1))continue;let{s0:x,s1:E,s2:W,s3:D}=c[u*h+C];y^=x,_^=E,v^=W,$^=D}f.push({s0:y,s1:_,s2:v,s3:$})}this.t=f}_updateBlock(t,r,n,o){t^=this.s0,r^=this.s1,n^=this.s2,o^=this.s3;let{W:s,t:i,windowSize:a}=this,c=0,u=0,l=0,d=0,p=(1<<s)-1,f=0;for(let h of[t,r,n,o])for(let m=0;m<4;m++){let y=h>>>8*m&255;for(let _=8/s-1;_>=0;_--){let v=y>>>s*_&p,{s0:$,s1:C,s2:w,s3:x}=i[f*a+v];c^=$,u^=C,l^=w,d^=x,f+=1}}this.s0=c,this.s1=u,this.s2=l,this.s3=d}update(t){Yo(this),we(t),t=rr(t);let r=bt(t),n=Math.floor(t.length/nr),o=t.length%nr;for(let s=0;s<n;s++)this._updateBlock(fe(r[s*4+0]),fe(r[s*4+1]),fe(r[s*4+2]),fe(r[s*4+3]));return o&&(Cd.set(t.subarray(n*nr)),this._updateBlock(fe($n[0]),fe($n[1]),fe($n[2]),fe($n[3])),ft($n)),this}destroy(){this.destroyed=!0;let{t}=this;for(let r of t)r.s0=0,r.s1=0,r.s2=0,r.s3=0}digestInto(t){Yo(this),fa(t,this),this.finished=!0;let{s0:r,s1:n,s2:o,s3:s}=this,i=bt(t);i[0]=r,i[1]=n,i[2]=o,i[3]=s,Or||vn(i.subarray(0,nr/4))}digest(){let t=new Uint8Array(nr);return this.digestInto(t),this.destroy(),t}};var ga=ha(16,(e,t)=>new ma(e,t),e=>[e.length]);var _a=16,Yb=4,es=new Uint8Array(_a);var Qb=283;function ew(e){if(![16,24,32].includes(e.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+e.length)}function ba(e){return e<<1^Qb&-(e>>7)}function Id(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=ba(e);return r}var tw=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=ba(n))e[r]=n;let t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return ft(e),t})();var rw=e=>e<<24|e>>>8,ya=e=>e<<8|e>>>24;function nw(e,t){if(e.length!==256)throw new Error("wrong sbox length");let r=new Uint32Array(256).map((u,l)=>t(e[l])),n=r.map(ya),o=n.map(ya),s=o.map(ya),i=new Uint32Array(256*256),a=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let u=0;u<256;u++)for(let l=0;l<256;l++){let d=u*256+l;i[d]=r[u]^n[l],a[d]=o[u]^s[l],c[d]=e[u]<<8|e[l]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:o,T3:s,T01:i,T23:a}}var jd=nw(tw,e=>Id(e,3)<<24|e<<16|e<<8|Id(e,2));var ow=(()=>{let e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=ba(r))e[t]=r;return e})();function sw(e){we(e);let t=e.length;ew(e);let{sbox2:r}=jd,n=[];(!Or||!Rr(e))&&n.push(e=rr(e));let o=vn(bt(e)),s=o.length,i=c=>Sn(r,c,c,c,c),a=new Uint32Array(t+28);a.set(o);for(let c=s;c<a.length;c++){let u=a[c-1];c%s===0?u=i(rw(u))^ow[c/s-1]:s>6&&c%s===4&&(u=i(u)),a[c]=a[c-s]^u}return ft(...n),a}function ts(e,t,r,n,o,s){return e[r<<8&65280|n>>>8&255]^t[o>>>8&65280|s>>>24&255]}function Sn(e,t,r,n,o){return e[t&255|r&65280]|e[n>>>16&255|o>>>16&65280]<<16}function Nd(e,t,r,n,o){let{sbox2:s,T01:i,T23:a}=jd,c=0;t^=e[c++],r^=e[c++],n^=e[c++],o^=e[c++];let u=e.length/4-2;for(let h=0;h<u;h++){let m=e[c++]^ts(i,a,t,r,n,o),y=e[c++]^ts(i,a,r,n,o,t),_=e[c++]^ts(i,a,n,o,t,r),v=e[c++]^ts(i,a,o,t,r,n);t=m,r=y,n=_,o=v}let l=e[c++]^Sn(s,t,r,n,o),d=e[c++]^Sn(s,r,n,o,t),p=e[c++]^Sn(s,n,o,t,r),f=e[c++]^Sn(s,o,t,r,n);return{s0:l,s1:d,s2:p,s3:f}}function rs(e,t,r,n,o){we(r,_a,"nonce"),we(n),o=Rd(n.length,o);let s=r,i=bt(s),a=Tr(s),c=bt(n),u=bt(o),l=t?0:12,d=n.length,p=a.getUint32(l,t);for(let h=0;h+4<=c.length;h+=4){let{s0:m,s1:y,s2:_,s3:v}=Nd(e,fe(i[0]),fe(i[1]),fe(i[2]),fe(i[3]));u[h+0]=c[h+0]^fe(m),u[h+1]=c[h+1]^fe(y),u[h+2]=c[h+2]^fe(_),u[h+3]=c[h+3]^fe(v),p=p+1>>>0,a.setUint32(l,p,t)}let f=_a*Math.floor(c.length/Yb);if(f<d){let{s0:h,s1:m,s2:y,s3:_}=Nd(e,fe(i[0]),fe(i[1]),fe(i[2]),fe(i[3])),v=new Uint32Array([h,m,y,_]);vn(v);let $=Ed(v);for(let C=f,w=0;C<d;C++,w++)o[C]=n[C]^$[w];ft(v)}return o}function iw(e,t,r,n,o){let s=o?o.length:0,i=e.create(r,n.length+s);o&&i.update(o);let a=Ad(8*n.length,8*s,t);i.update(n),i.update(a);let c=i.digest();return ft(a),c}var wa=Od({blockSize:16,nonceLength:12,tagLength:16,withAAD:!0,varSizeNonce:!0},function(t,r,n){if(r.length<8)throw new Error("aes/gcm: invalid nonce length");let o=16;function s(a,c,u){let l=iw(ga,!1,a,u,n);for(let d=0;d<c.length;d++)l[d]^=c[d];return l}function i(){let a=sw(t),c=es.slice(),u=es.slice();if(rs(a,!1,u,u,c),r.length===12)u.set(r);else{let d=es.slice();Tr(d).setBigUint64(8,BigInt(r.length*8),!1);let f=ga.create(c).update(r).update(d);f.digestInto(u),f.destroy()}let l=rs(a,!1,u,es);return{xk:a,authKey:c,counter:u,tagMask:l}}return{encrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=new Uint8Array(a.length+o),f=[c,u,l,d];Rr(a)||f.push(a=rr(a)),rs(c,!1,l,a,p.subarray(0,a.length));let h=s(u,d,p.subarray(0,p.length-o));return f.push(h),p.set(h,a.length),ft(...f),p},decrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=[c,u,d,l];Rr(a)||p.push(a=rr(a));let f=a.subarray(0,-o),h=a.subarray(-o),m=s(u,d,f);if(p.push(m),!Td(m,h))throw ft(...p),new Error("aes-gcm: invalid tag");let y=rs(c,!1,l,f);return ft(...p),y}}});function Zd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var xa=e=>e?`"${e}" `:"";function zn(e,t=""){if(typeof e!="number")throw new TypeError(xa(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(xa(t)+"expected integer >= 0, got "+e);return e}function Nt(e,t,r=""){if(Zd(e)&&(t===void 0||e.length===t))return e;t!==void 0&&zn(t,"length");let n=Zd(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=xa(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function kn(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(zn(e.outputLen),zn(e.blockLen),e.outputLen<1||e.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var aw=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},Dd=(e,t)=>{aw(e,t);let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function Ar(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function ns(e,t){Nt(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function pt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function os(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rt(e,t){return e<<32-t|e>>>t}function cw(e,t,r="opts"){return Dd(e,"defaults"),t!==void 0&&Dd(t,r),Object.assign(Object.create(null),e,t)}function Md(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=cw({},t,"info");let r=(o,s)=>e(s).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}var Ld=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var ss=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(kn(t),Nt(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("expected Hash instance");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?t.create().update(r).digest():r);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),pt(o)}update(t){return Ar(this),this.iHash.update(t),this}digestInto(t){Ar(this),ns(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a,canXOF:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.canXOF=c,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Pn=(()=>{let e=((t,r,n)=>new ss(t,r).update(n).digest());return e.create=(t,r)=>new ss(t,r),e})();var En=Uint8Array.of(0),uw=Uint8Array.of();function lw(e,t,r,n=32,o){kn(e),zn(n,"length"),Nt(t,void 0,"prk");let s=e.outputLen;if(t.length<s)throw new Error('"prk" must be at least HashLen octets');if(n>255*s)throw new Error("Length must be <= 255*HashLen");let i=Math.ceil(n/s);if(r===void 0?r=uw:Nt(r,void 0,"info"),!i)return o&&pt(t),new Uint8Array;let a=o&&i===1?t:new Uint8Array(i*s),{iHash:c,oHash:u}=Pn.create(e,t),l=o?t:new Uint8Array(s),d=i>1?o?.iHash||e.create():void 0;for(let f=0;f<i-1;f++){En[0]=f+1;let h=c._cloneInto(d);f&&h.update(l),h.update(r).update(En).digestInto(l),u._cloneInto(d).update(l).digestInto(l),a.set(l,s*f)}if(En[0]=i,i>1&&c.update(l),c.update(r).update(En).digestInto(l),u.update(l).digestInto(l),a.set(l,s*(i-1)),c.destroy(),u.destroy(),d?.destroy(),l!==a&&pt(l),pt(En),n===a.length)return a;let p=a.slice(0,n);return pt(a),p}var va=(e,t,r,n,o)=>{kn(e),r===void 0&&(r=new Uint8Array(e.outputLen));let s=Pn.create(e,r).update(t);return lw(e,s.digest(),n,o,s)};var dw=e=>e/2**32|0,fw=e=>e>>>0;function Ud(e,t,r,n){let o=dw(r),s=fw(r);e.setUint32(t,n?s:o,n),e.setUint32(t+4,n?o:s,n)}function qd(e,t,r){return e&t^~e&r}function Fd(e,t,r){return e&t^e&r^t&r}var is=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,o){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=os(this.buffer)}update(t){Ar(this),Nt(t);let{view:r,buffer:n,blockLen:o}=this,s=t.length,i=!1;for(let a=0;a<s;){let c=Math.min(o-this.pos,s-a);if(c===o){let u=os(t);for(;o<=s-a;a+=o)this.process(u,a);i=!0;continue}n.set(a===0&&c===s?t:t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(r,0),this.pos=0,i=!0)}return this.length+=t.length,i&&this.roundClean(),this}digestInto(t){Ar(this),ns(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,r.fill(0,i),this.padOffset>o-i&&(this.process(n,0),r.fill(0)),Ud(n,o-8,this.length*8,s),this.process(n,0),this.roundClean();let a=t===r?n:os(t),c=this.outputLen,u=c/4,l=this.get();if(c%4||u>l.length)throw new Error("invalid outputLen");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneIntoMeta(t){let{buffer:r,length:n,finished:o,destroyed:s,pos:i}=this;return t.destroyed=s,t.finished=o,t.length=n,t.pos=i,i&&t.buffer.set(r),t}clone(){return this._cloneInto()}},Bd=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var pw=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),jt=new Uint32Array(64),$a=class extends is{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,r){super(64,t,8,!1),this.A=r[0]|0,this.B=r[1]|0,this.C=r[2]|0,this.D=r[3]|0,this.E=r[4]|0,this.F=r[5]|0,this.G=r[6]|0,this.H=r[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,r,n,o,s,i,a,c]}set(t,r,n,o,s,i,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,r){for(let d=0;d<16;d++,r+=4)jt[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let p=jt[d-15],f=jt[d-2],h=rt(p,7)^rt(p,18)^p>>>3,m=rt(f,17)^rt(f,19)^f>>>10;jt[d]=m+jt[d-7]+h+jt[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){let p=rt(a,6)^rt(a,11)^rt(a,25),f=l+p+qd(a,c,u)+pw[d]+jt[d]|0,m=(rt(n,2)^rt(n,13)^rt(n,22))+Fd(n,o,s)|0;l=u,u=c,c=a,a=i+f|0,i=s,s=o,o=n,n=f+m|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,o,s,i,a,c,u,l)}roundClean(){pt(jt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),pt(this.buffer)}},Sa=class extends $a{constructor(){super(32,Bd)}};var as=Md(()=>new Sa,Ld(1));var Tn=new TextEncoder,hw=new TextDecoder,mw="ape1",Vd=/^ape1\.([A-Za-z0-9_-]{16})\.([A-Za-z0-9_-]+)$/,gw=/^[A-Za-z0-9_-]{43}$/,yw=/^jb_live_[A-Za-z0-9]{40}$/;function cs(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function za(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)),r=new Uint8Array(new ArrayBuffer(t.length));for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Hd(){return cs(globalThis.crypto.getRandomValues(new Uint8Array(32)))}var ka=e=>gw.test(e),Kd=e=>typeof e=="string"&&Vd.test(e);function Jd(e){let t=e.trim();if(ka(t))return{token:null,key:t};let[r,n,...o]=t.split(".");if(!yw.test(r)||o.length||n!==void 0&&!ka(n))throw new Error("Not a valid Jotbus token or connection string");return{token:r,key:n??null}}var us=(e,t)=>`${e}.${t}`;async function On(e){if(!ka(e))throw new Error("Invalid workspace key");let t=za(e),r=new Uint8Array(32),n=va(as,t,r,Tn.encode("agentpad/v1/enc"),32),o=va(as,t,r,Tn.encode("agentpad/v1/check"),32),s=cs(Pn(as,o,Tn.encode("agentpad/v1/key-check"))),i=a=>Tn.encode(`agentpad/v1/${a}`);return{check:s,async encrypt(a,c){let u=globalThis.crypto.getRandomValues(new Uint8Array(12)),l=wa(n,u,i(a)).encrypt(Tn.encode(JSON.stringify(c)));return`${mw}.${cs(u)}.${cs(l)}`},async decrypt(a,c){let u=Vd.exec(c);if(!u)throw new Error("Not an encrypted message");let l=wa(n,za(u[1]),i(a)).decrypt(za(u[2])),d=JSON.parse(hw.decode(l));if(typeof d?.c!="string")throw new Error("Malformed message");return d}}}var _w=/jb1_([A-Za-z0-9]{24})\.([A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/,Wd=(e,t)=>`${e}.${t}`;function Gd(e){let t=_w.exec(e.trim());return t?{invite:`jb1_${t[1]}`,key:t[2]}:null}var or="0.4.0",sr="https://app.jotbus.com",ls=`${sr}/mcp`;var xw=!!(process.stdin.isTTY&&process.stdout.isTTY),Ir=e=>t=>process.stdout.isTTY&&!process.env.NO_COLOR?`\x1B[${e}m${t}\x1B[0m`:t,Cr=Ir("1"),Je=Ir("2"),Pa=Ir("32"),Yd=Ir("36"),vw=Ir("33"),pe=(e="")=>process.stdout.write(`${e}
|
|
11
|
+
`);function ds(e){process.stderr.write(`${Ir("31")("\u2717")} ${e}
|
|
12
|
+
`),process.exit(1)}async function Qd(e,t,r){let n;try{n=await fetch(`${e.origin}/anon/${t}`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"jotbus-cli"},body:JSON.stringify(r)})}catch(s){ds(`Couldn't reach ${e.origin} (${s.message}).`)}let o=await n.json().catch(()=>({}));return n.ok||ds(o.error??`Request failed (${n.status}).`),o}function ef(e){return Math.max(0,Math.round((new Date(e).getTime()-Date.now())/6e4))}var tf=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),ir=(e,t)=>bw(e,t,{stdio:"pipe",encoding:"utf8",timeout:3e4}),$w=e=>ir(e,["--version"]).status===0,Xd=[{name:"Claude Code",bin:"claude",exists:()=>ir("claude",["mcp","get","jotbus"]).status===0,remove:()=>ir("claude",["mcp","remove","jotbus","-s","user"]).status===0,add:(e,t)=>ir("claude",["mcp","add","--scope","user","jotbus","-e",`JOTBUS_TOKEN=${e}`,"--","npx",...t]).status===0,manual:(e,t)=>`claude mcp add --scope user jotbus -e JOTBUS_TOKEN=${e} -- npx ${t.join(" ")}`},{name:"Codex",bin:"codex",exists:()=>/\bjotbus\b/.test(ir("codex",["mcp","list"]).stdout??""),remove:()=>ir("codex",["mcp","remove","jotbus"]).status===0,add:(e,t)=>ir("codex",["mcp","add","jotbus","--env",`JOTBUS_TOKEN=${e}`,"--","npx",...t]).status===0,manual:(e,t)=>`codex mcp add jotbus --env JOTBUS_TOKEN=${e} -- npx ${t.join(" ")}`}];async function Sw(e,t){if(!xw)return t;let r=ww({input:process.stdin,output:process.stdout}),n=(await r.question(`${e} ${Je(t?"[Y/n]":"[y/N]")} `)).trim().toLowerCase();return r.close(),n===""?t:n.startsWith("y")}async function rf(e,t){let r=["-y","jotbus@latest",...e.origin===sr?[]:["--url",`${e.origin}/mcp`]],n=Xd.filter(s=>$w(s.bin)),o=[];if(!e.install||n.length===0){pe(Cr("Add it to your agent:"));for(let s of Xd)pe(` ${Je(s.name+":")} ${s.manual(t,r)}`);return pe(` ${Je("Other MCP clients:")} command "npx ${r.join(" ")}" with env JOTBUS_TOKEN=${t}`),o}for(let s of n){if(s.exists()){if(!(e.yes||await Sw(`${s.name} already has a Jotbus connection. Replace it with this workspace?`,!1))){pe(Je(` Skipped ${s.name}. To switch later, run: npx jotbus@latest join \u2026 --yes (or remove its "jotbus" server and add: ${s.manual(t,r)})`));continue}s.remove()}s.add(t,r)?(o.push(s.name),pe(`${Pa("\u2713")} Added to ${s.name}`)):pe(`${vw("!")} Couldn't add to ${s.name} automatically. Run:
|
|
13
|
+
${s.manual(t,r)}`)}return o}function nf(e){pe(),pe(Cr("Then tell your agent:")),pe(` ${Yd('"Use Jotbus to collaborate."')}`),e.includes("Claude Code")?pe(Je(" (Start a new Claude Code session so it picks up the new connection.)")):e.length&&pe(Je(" (Restart your agent so it picks up the new connection.)"))}async function Ea(e){let t=Hd(),r=await On(t),n=await Qd(e,"workspaces",{key_check:r.check}),o=Wd(n.invite,t);pe(`${Pa("\u2713")} Created temporary workspace ${Cr(n.name)} ${Je(`(end-to-end encrypted, expires in ${ef(n.expires_at)} minutes at ${tf(n.expires_at)})`)}`);let s=await rf(e,us(n.token,t));pe(),pe(Cr("Connect another machine or person:"));let i=e.origin===sr?"":` --origin ${e.origin}`;pe(` ${Yd(`npx jotbus@latest join ${o}${i}`)}`),pe(Je(` or share this link: ${e.origin}/join#${o}`)),pe(Je(" No account needed. Up to 3 connected clients. The invite includes the encryption key, so share it privately.")),pe(),pe(Cr("Keep it beyond 60 minutes:")),pe(Je(` ${e.origin}/claim#${us(n.token,t)}`)),pe(Je(" (only you have this link; it keeps the history and every connected agent)")),nf(s)}async function of(e,t){let r=t?Gd(t):null;r||ds("Usage: npx jotbus join <invite> (the jb1_\u2026 invite or join link you were sent)");let n=await On(r.key),o=await Qd(e,"join",{invite:r.invite});o.key_check!==n.check&&ds("This invite's encryption key doesn't match the workspace. Ask for a fresh invite."),pe(`${Pa("\u2713")} Joined ${Cr(o.name)} ${Je(`(end-to-end encrypted, expires in ${ef(o.expires_at)} minutes at ${tf(o.expires_at)})`)}`);let s=await rf(e,us(o.token,r.key));nf(s)}import{webcrypto as _O}from"node:crypto";import{hostname as bO}from"node:os";var j={};ua(j,{BIGINT_FORMAT_RANGES:()=>ms,CONSTANT_CATCH:()=>yf,Class:()=>Ra,NUMBER_FORMAT_RANGES:()=>An,aborted:()=>nt,allowsEval:()=>ja,assert:()=>Tw,assertEqual:()=>zw,assertIs:()=>Pw,assertNever:()=>Ew,assertNotEqual:()=>kw,assignProp:()=>Ve,attachSchema:()=>ys,base64ToUint8Array:()=>mf,base64urlToUint8Array:()=>Jw,cached:()=>Dr,captureStackTrace:()=>ps,cleanEnum:()=>Kw,cleanRegex:()=>Rn,clone:()=>We,cloneDef:()=>Aw,codePointLength:()=>Cn,constantCatch:()=>_f,createTransparentProxy:()=>Dw,defineLazy:()=>cf,defineLazyInternal:()=>G,derived:()=>Yw,esc:()=>Ia,escapeRegex:()=>vt,explicitlyAborted:()=>Ma,extend:()=>Uw,finalizeIssue:()=>ot,floatSafeRemainder:()=>Ca,getElementAtPath:()=>Cw,getEnumValues:()=>jr,getLengthableOrigin:()=>In,getParsedType:()=>Zw,getSizableOrigin:()=>hf,hexToUint8Array:()=>Gw,hide:()=>_s,installLazyProp:()=>rx,isObject:()=>cr,isPlainObject:()=>Mt,issue:()=>Lr,joinValues:()=>fs,jsonStringifyReplacer:()=>Zr,members:()=>Ua,merge:()=>Fw,mergeDefs:()=>xt,normalizeParams:()=>I,nullish:()=>Aa,numKeys:()=>jw,objectClone:()=>Ow,omit:()=>Lw,optionalKeys:()=>Da,own:()=>Dt,parsedType:()=>La,partial:()=>Bw,pick:()=>Mw,prefixIssues:()=>$t,primitiveTypes:()=>ff,promiseAllObject:()=>Iw,propertyKeyTypes:()=>Za,randomString:()=>Nw,rawShape:()=>Mr,required:()=>Vw,safeExtend:()=>qw,shallowClone:()=>df,slugify:()=>Na,stringifyPrimitive:()=>hs,toZod:()=>af,uint8ArrayToBase64:()=>gf,uint8ArrayToBase64url:()=>Ww,uint8ArrayToHex:()=>Xw,unwrapMessage:()=>Nr});function zw(e){return e}function kw(e){return e}function af(){return e=>e}function Pw(e){}function Ew(e){throw new Error("Unexpected value in exhaustive check")}function Tw(e){}function jr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function fs(e,t="|"){return e.map(r=>hs(r)).join(t)}function Zr(e,t){return typeof t=="bigint"?t.toString():t}var Oa=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 Oa(e)}function Aa(e){return e==null}function Rn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ca(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var sf=Symbol("evaluating");function cf(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==sf)return n===void 0&&(n=sf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ow(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ve(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Mr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function wt(e){return Mr(e._zod.def)??e._zod.def.shape}function uf(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Ve(this,t,n),n},enumerable:!0,configurable:!0})}function lf(e,t,r){t in e?Ve(e,t,r):e[t]=r}function ar(e,t,r,n){let o=wt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?uf(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a}):lf(e,s,n?n(i.value,s):i.value))}}function Rw(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?uf(e,r,()=>t[r]):lf(e,r,n.value))}}function xt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Aw(e){return xt(e._zod.def)}function Cw(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Iw(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Nw(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ia(e){return JSON.stringify(e)}function Na(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ps="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function cr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ja=Dr(()=>{if(Ze.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Mt(e){if(cr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(cr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function df(e){return Mt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function jw(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Zw=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}`)}},Za=new Set(["string","number","symbol"]),ff=new Set(["string","number","bigint","boolean","symbol","undefined"]);function vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(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 Dw(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function hs(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Da(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var An={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]},ms={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Mw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return ar(s,e,gs(e,t)),We(e,xt(r,{shape:s,checks:[]}))}function gs(e,t){let r=wt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Lw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(gs(e,t)),i={};return ar(i,e,Reflect.ownKeys(wt(e)).filter(a=>!s.has(a))),We(e,xt(r,{shape:i,checks:[]}))}function Uw(e,t){if(!Mt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=wt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,xt(e._zod.def,{shape:pf(e,t)}))}function pf(e,t){let r={};return ar(r,e,Reflect.ownKeys(wt(e))),Rw(r,t),r}function qw(e,t){if(!Mt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return We(e,xt(e._zod.def,{shape:pf(e,t)}))}function Fw(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={};ar(r,e,Reflect.ownKeys(wt(e))),ar(r,t,Reflect.ownKeys(wt(t)));let n=xt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return We(e,n)}function Bw(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(gs(t,r)):void 0,c={};return ar(c,t,Reflect.ownKeys(wt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),We(t,xt(t._zod.def,{shape:c,checks:[]}))}function Vw(e,t,r){let n=r?new Set(gs(t,r)):void 0,o={};return ar(o,t,Reflect.ownKeys(wt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),We(t,xt(t._zod.def,{shape:o}))}function nt(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 Ma(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 n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Nr(e){return typeof e=="string"?e:e?.message}function ys(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function ot(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.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:Nr(e.inst?._zod.def?.error?.(e))??Nr(s?.(e))??Nr(t?.error?.(e))??Nr(r.customError?.(e))??Nr(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function hf(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Hw=/[\uD800-\uDBFF]/;function Cn(e){let t=e.length;if(!Hw.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function In(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function La(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 Lr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Kw(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function mf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function gf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Jw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return mf(t+r)}function Ww(e){return gf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Gw(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 n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Xw(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ra=class{constructor(...t){}};function Ua(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Qw(e,r,n.value)}}function Dt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function _s(e,t,r){return Dt(e,t,r,!1)}function Yw(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Dt(this,r,n(this))},set(o){Dt(this,r,o)}})}return t}function Qw(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Dt(this,t,r.bind(this))},set(n){Dt(this,t,n)}})}function ex(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ta,Zt=!1,tx={configurable:!0,get(){Zt=!0}};function G(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ta!==e._zod){Ta=void 0;return}Ta=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,tx);let o=Zt;Zt=!1;try{let s=r(this);return Zt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),Zt=Zt||o,s}catch(s){throw delete this[t],Zt=Zt||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function rx(e,t,r,n){let o=ex(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,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:n,value:s})}})}var yf="~constantCatch";function _f(e){let t=()=>e;return t[yf]=!0,t}var bf,Fa=Object.freeze({status:"aborted"}),qa={value:void 0,enumerable:!1},wf="captureStackTrace"in Error?Error:null;function nx(e){let t=wf;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return wf=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function s(p){this.def=p,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(p,f){if(p._zod){if(p._zod.traits.has(e))return}else{qa.value=new s(f);try{Object.defineProperty(p,"_zod",qa)}finally{qa.value=void 0}}if(p._zod.traits.add(e),t(p,f),a){let m=Object.getPrototypeOf(p),y=p._zod.constr.prototype,_=m;for(;_&&_!==y;)_=Object.getPrototypeOf(_);let v=_??m;a.has(v)||(a.add(v),Ua(v,i))}let h=d.prototype;for(let m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in p||(p[m]=h[m].bind(p)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(p){let f=n?.Parent?nx(l):this;c(f,p);let h=f._zod.deferred;if(h){for(let y of h)y();f._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(f),f}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var st=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ur=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(bf=globalThis).__zod_globalConfig??(bf.__zod_globalConfig={});var Ze=globalThis.__zod_globalConfig;function De(e){return e&&Object.assign(Ze,e),Ze}function ox(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Zr,2)),e.message}function sx(e){this._zod.message=e}var ix={get:ox,set:sx,enumerable:!0,configurable:!0},Va={value:void 0,enumerable:!1},xf=new WeakSet([Object.prototype,Error.prototype]),vf=(e,t)=>{e.name="$ZodError",Va.value=t,Object.defineProperty(e,"issues",Va),Va.value=void 0,Object.defineProperty(e,"message",ix);let r=Object.getPrototypeOf(e);xf.has(r)||(xf.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},$f=b("$ZodError",vf),Sf=b("$ZodError",vf,void 0,{Parent:Error});function ax(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 Ha(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ax(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ka(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];d&&p._errors.push(t(i)),c=p,u++}}}};return n(e),r}function bs(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ws=e=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new st;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>ot(u,i,De())));throw ps(c,s?.callee??t),c}return a.value};return t};var xs=e=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>ot(u,i,De())));throw ps(c,s?.callee??t),c}return a.value};return t};var Nn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new st;return s.issues.length?zf(e,s.issues,o):{success:!0,data:s.value}},Ja=Nn(Sf);function zf(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>ot(o,r,De()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var vs=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?zf(e,s.issues,o):{success:!0,data:s.value}};var ux=Symbol.for("zod.compile.invalid"),lx=Symbol.for("zod.compile.fallback"),$s=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ux)return!0;if(n.definite===!0&&r===void 0)return!1}return dx(e,t,r)});function dx(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o?(n[lx]=!0,s=o({value:t,issues:[]},n)):s=e._zod.run({value:t,issues:[]},n),s instanceof Promise)throw new st;return s.issues.length===0}var Ss=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},kf=e=>{let t=ws(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,bs(r,i))};return r};var Pf=e=>{let t=ws(e),r=(n,o,s,i)=>t(n,o,s,bs(r,i));return r};var Ef=e=>{let t=xs(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,bs(r,i))};return r};var Tf=e=>{let t=xs(e),r=async(n,o,s,i)=>await t(n,o,s,bs(r,i));return r};var Of=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Nn(e)(t,r,o)};var Rf=e=>(t,r,n)=>Nn(e)(t,r,n);var Af=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return vs(e)(t,r,o)};var Cf=e=>async(t,r,n)=>vs(e)(t,r,n);var If=/^[cC][0-9a-z]{6,}$/,Nf=/^[0-9a-z]+$/,jf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Zf=/^[0-9a-vA-V]{20}$/,Df=/^[A-Za-z0-9]{27}$/,Mf=/^[a-zA-Z0-9_-]{21}$/;function Lf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Uf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var qf=/^([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})$/,Ga=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 Ff=/^(?:[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 fx="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Bf(){return new RegExp(fx,"u")}var Vf=/^(?:(?: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])$/,Hf=/^(([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 Kf=/^((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])$/,Jf=/^(([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])$/,Wf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Xf=/^https?$/,Yf=/^\+[1-9]\d{6,14}$/;var Qf="(?:(?:\\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 px(e){return new RegExp(`^${e}$`)}var ep=px(Qf);function Wa(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 tp(e){return new RegExp(`^${Wa(e)}$`)}function rp(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Wa({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Wa({precision:e.precision})}`:r;return new RegExp(`^${Qf}T(?:${n})$`)}var np=/^[\s\S]{0,}$/;var op=/^-?\d+n?$/,Xa=/^-?\d+$/,jn=/^-?\d+(?:\.\d+)?$/,sp=/^(?:true|false)$/i,ip=/^null$/i;var ap=/^[^A-Z]*$/,cp=/^[^a-z]*$/;var xe=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ya=e=>{let t=e.value;return!Aa(t)&&t.length!==void 0},zs={number:"number",bigint:"bigint",object:"date"},Qa=b("$ZodCheckLessThan",(e,t)=>{xe.init(e,t);let r=zs[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:zs[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ec=b("$ZodCheckGreaterThan",(e,t)=>{xe.init(e,t);let r=zs[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:zs[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),up=b("$ZodCheckMultipleOf",(e,t)=>{xe.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):Ca(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})}}),lp=b("$ZodCheckNumberFormat",(e,t)=>{xe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=An[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,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:n,inclusive:!0,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:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var dp=b("$ZodCheckMaxLength",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=Ya),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>t.maximum?Cn(o):s)<=t.maximum)return;let a=In(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fp=b("$ZodCheckMinLength",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=Ya),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?Cn(o):s)>=t.minimum)return;let a=In(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),pp=b("$ZodCheckLengthEquals",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=Ya),e._zod.check=n=>{let o=n.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?Cn(o):s;if(i===t.length)return;let a=In(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Zn=b("$ZodCheckStringFormat",(e,t)=>{var r,n;xe.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),hp=b("$ZodCheckRegex",(e,t)=>{Zn.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})}}),mp=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ap),Zn.init(e,t)}),gp=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cp),Zn.init(e,t)}),yp=b("$ZodCheckIncludes",(e,t)=>{xe.init(e,t);let r=vt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),_p=b("$ZodCheckStartsWith",(e,t)=>{xe.init(e,t);let r=new RegExp(`^${vt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),bp=b("$ZodCheckEndsWith",(e,t)=>{xe.init(e,t);let r=new RegExp(`.*${vt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var wp=b("$ZodCheckOverwrite",(e,t)=>{xe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ks=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 n=t.split(`
|
|
14
14
|
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).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(", ")}) {
|
|
15
15
|
${r.join(`
|
|
16
16
|
`)}
|
|
17
|
-
};`)(...Object.values(this.closed))}};var bp={major:4,minor:6,patch:5};var W=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=Qe(a),d;for(let p of c){if(p._zod.def.when){if(Da(a)||!p._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new tt;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==f&&(hs(a.issues,f,e),l||(l=Qe(a,f)))});else{if(a.issues.length===f)continue;hs(a.issues,f,e),l||(l=Qe(a,f))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(Qe(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new tt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new tt;return u.then(l=>s(l,o,c))}return s(u,o,c)}}},{get"~standard"(){return ms(this,"~standard",tc(this))},set"~standard"(e){Zt(this,"~standard",e)}}),Op=(e,t)=>e.issues.length?{issues:e.issues.map(r=>et(r,t,Ne()))}:{value:e.value};async function dx(e,t){let r={async:!0};return Op(await e._zod.run({value:t,issues:[]},r),r)}function tc(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Op(n,r)}catch{}return dx(e,t)},vendor:"zod",version:1}}var Ps=b("$ZodString",(e,t)=>{W.init(e,t),e._zod.pattern=t.pattern??ep,e._zod.parse=(r,n)=>{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}}),te=b("$ZodStringFormat",(e,t)=>{Nn.init(e,t),Ps.init(e,t)}),Rp=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Mf),te.init(e,t)}),Ap=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wa(n))}else t.pattern??(t.pattern=Wa());te.init(e,t)}),Cp=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Lf),te.init(e,t)}),Ip=1,zs=2;function Np(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function fx(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Np(e)||zs:px(e,t)}function px(e,t){if(!t.normalize&&t.protocol?.source===Jf.source&&!/^https?:\/\//i.test(e))return Ip;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 hx=/[\t\n\r]/g;function wp(e){return e.replace(hx,"")}function mx(e,t){return t.lastIndex=0,t.test(e.hostname)}function gx(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var jp=b("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=fx(n,t);if(o===Ip){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===zs){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=wp(n);return}t.hostname&&!mx(o,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&&!gx(o,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?o.href:wp(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Zp=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Uf()),te.init(e,t)}),Dp=b("$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?jf:Zf(t.length)),te.init(e,t)}),Mp=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rf),te.init(e,t)}),Lp=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Af),te.init(e,t)}),Up=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cf),te.init(e,t)}),qp=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=If),te.init(e,t)}),Fp=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Nf),te.init(e,t)}),Bp=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qf(t)),te.init(e,t)}),Vp=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Xf),te.init(e,t)}),Hp=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yf(t)),te.init(e,t)}),Kp=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Df),te.init(e,t)}),Jp=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qf),te.init(e,t)}),yx=/^[0-9a-fA-F:.]+$/;function Wp(e){return yx.test(e)?Np(`http://[${e}]`):!1}var Gp=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ff),te.init(e,t),e._zod.check=r=>{Wp(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Xp=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bf),te.init(e,t)});function _x(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Wp(r)}var Yp=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vf),te.init(e,t),e._zod.check=r=>{_x(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Qp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var rc=/^[0-9a-zA-Z+/]*={0,2}$/,eh=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rc),te.init(e,t),e._zod.check=r=>{Qp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Es=/^[A-Za-z0-9_-]*$/;function bx(e){if(!Es.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qp(r)}var th=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Es),te.init(e,t),e._zod.check=r=>{bx(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rh=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wf),te.init(e,t)});function wx(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var nh=b("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=r=>{wx(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var nc=b("$ZodNumber",(e,t)=>{W.init(e,t),e._zod.pattern=In,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),oh=b("$ZodNumberFormat",(e,t)=>{ap.init(e,t),nc.init(e,t)}),sh=b("$ZodBoolean",(e,t)=>{W.init(e,t),e._zod.pattern=rp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),ih=b("$ZodBigInt",(e,t)=>{W.init(e,t),e._zod.pattern=tp,e._zod.parse=(r,n)=>{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 ah=b("$ZodNull",(e,t)=>{W.init(e,t),e._zod.pattern=np,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),ch=b("$ZodAny",(e,t)=>{W.init(e,t),e._zod.parse=r=>r}),uh=b("$ZodUnknown",(e,t)=>{W.init(e,t),e._zod.parse=r=>r}),lh=b("$ZodNever",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var dh=b("$ZodDate",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function xp(e,t,r){e.issues.length&&t.issues.push(...vt(r,e.issues)),t.value[r]=e.value}var fh=b("$ZodArray",(e,t)=>{W.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then(d=>xp(d,n,c)));else if(xp(l,n,c),a&&l.issues.length!==0&&Qe(l))break}return i.length?Promise.all(i).then(()=>n):n}});function ks(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...vt(r,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var xx=[];function ph(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:xx,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Za(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function hh(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,p=u.optout,f=0;for(let h in t){if(i&&r.issues.length!==f){if(Qe(r,f))break;f=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let m=u.run({value:t[h],issues:[]},n);m instanceof Promise?e.push(m.then(y=>ks(y,r,h,t,d,p))):ks(m,r,h,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var vx=b("$ZodObject",(e,t)=>{W.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=jr(()=>ph(t));H(e,"propValues",u=>{let l=u.def.shape,d={};for(let p in l){let f=l[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,p)||qe(d,p,new Set);for(let h of f.values)d[p].add(h);f.optin!==void 0&&d[p].add(void 0)}}return d});let s=ar,i=t.catchall,a,c=Ie.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],f=a.shape,h=l?.abortEarly,m=u.issues.length;for(let y of a.allKeys){if(h&&u.issues.length!==m){if(Qe(u,m))break;m=u.issues.length}if(y==="__proto__")continue;let w=f[y],v=w._zod.optin,S=w._zod.optout,T=w._zod.run({value:d[y],issues:[]},l);T instanceof Promise?p.push(T.then(_=>ks(_,u,y,d,v,S))):ks(T,u,y,d,v,S)}return i?hh(p,d,u,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>u):u}}),mh=b("$ZodObjectJIT",(e,t)=>{vx.init(e,t);let r=e._zod.parse,n=jr(()=>ph(t)),o=Ie.memoizer,s=f=>{let h=n.value,m=h.symbolKeys,y=new $s(["payload","ctx"],{shape:f,inst:e,memo:o,syms:m}),w=_=>`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`,v=(_,x)=>`
|
|
18
|
-
let ${
|
|
19
|
-
for (let i = 0; i < ${
|
|
20
|
-
const iss = ${
|
|
17
|
+
};`)(...Object.values(this.closed))}};var vp={major:4,minor:6,patch:5};var Q=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=nt(a),d;for(let p of c){if(p._zod.def.when){if(Ma(a)||!p._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new st;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==f&&(ys(a.issues,f,e),l||(l=nt(a,f)))});else{if(a.issues.length===f)continue;ys(a.issues,f,e),l||(l=nt(a,f))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(nt(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new st;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new st;return u.then(l=>s(l,o,c))}return s(u,o,c)}}},{get"~standard"(){return _s(this,"~standard",rc(this))},set"~standard"(e){Dt(this,"~standard",e)}}),Cp=(e,t)=>e.issues.length?{issues:e.issues.map(r=>ot(r,t,De()))}:{value:e.value};async function hx(e,t){let r={async:!0};return Cp(await e._zod.run({value:t,issues:[]},r),r)}function rc(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Cp(n,r)}catch{}return hx(e,t)},vendor:"zod",version:1}}var Os=b("$ZodString",(e,t)=>{Q.init(e,t),e._zod.pattern=t.pattern??np,e._zod.parse=(r,n)=>{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}}),se=b("$ZodStringFormat",(e,t)=>{Zn.init(e,t),Os.init(e,t)}),Ip=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=qf),se.init(e,t)}),Np=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ga(n))}else t.pattern??(t.pattern=Ga());se.init(e,t)}),jp=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ff),se.init(e,t)}),Zp=1,Es=2;function Dp(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function mx(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Dp(e)||Es:gx(e,t)}function gx(e,t){if(!t.normalize&&t.protocol?.source===Xf.source&&!/^https?:\/\//i.test(e))return Zp;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Es}return new URL(e)}catch{return Es}}var yx=/[\t\n\r]/g;function $p(e){return e.replace(yx,"")}function _x(e,t){return t.lastIndex=0,t.test(e.hostname)}function bx(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Mp=b("$ZodURL",(e,t)=>{se.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=mx(n,t);if(o===Zp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Es){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=$p(n);return}t.hostname&&!_x(o,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&&!bx(o,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?o.href:$p(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Lp=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bf()),se.init(e,t)}),Up=b("$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?Mf:Lf(t.length)),se.init(e,t)}),qp=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=If),se.init(e,t)}),Fp=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nf),se.init(e,t)}),Bp=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=jf),se.init(e,t)}),Vp=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Zf),se.init(e,t)}),Hp=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Df),se.init(e,t)}),Kp=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=rp(t)),se.init(e,t)}),Jp=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ep),se.init(e,t)}),Wp=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tp(t)),se.init(e,t)}),Gp=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Uf),se.init(e,t)}),Xp=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vf),se.init(e,t)}),wx=/^[0-9a-fA-F:.]+$/;function Yp(e){return wx.test(e)?Dp(`http://[${e}]`):!1}var Qp=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Hf),se.init(e,t),e._zod.check=r=>{Yp(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var eh=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Kf),se.init(e,t)});function xx(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Yp(r)}var th=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Jf),se.init(e,t),e._zod.check=r=>{xx(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function rh(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var nc=/^[0-9a-zA-Z+/]*={0,2}$/,nh=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nc),se.init(e,t),e._zod.check=r=>{rh(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Rs=/^[A-Za-z0-9_-]*$/;function vx(e){if(!Rs.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return rh(r)}var oh=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Rs),se.init(e,t),e._zod.check=r=>{vx(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),sh=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Yf),se.init(e,t)});function $x(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var ih=b("$ZodJWT",(e,t)=>{se.init(e,t),e._zod.check=r=>{$x(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var oc=b("$ZodNumber",(e,t)=>{Q.init(e,t),e._zod.pattern=jn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),ah=b("$ZodNumberFormat",(e,t)=>{lp.init(e,t),oc.init(e,t)}),ch=b("$ZodBoolean",(e,t)=>{Q.init(e,t),e._zod.pattern=sp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),uh=b("$ZodBigInt",(e,t)=>{Q.init(e,t),e._zod.pattern=op,e._zod.parse=(r,n)=>{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 lh=b("$ZodNull",(e,t)=>{Q.init(e,t),e._zod.pattern=ip,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),dh=b("$ZodAny",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),fh=b("$ZodUnknown",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),ph=b("$ZodNever",(e,t)=>{Q.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var hh=b("$ZodDate",(e,t)=>{Q.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Sp(e,t,r){e.issues.length&&t.issues.push(...$t(r,e.issues)),t.value[r]=e.value}var mh=b("$ZodArray",(e,t)=>{Q.init(e,t);let r=Ze.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then(d=>Sp(d,n,c)));else if(Sp(l,n,c),a&&l.issues.length!==0&&nt(l))break}return i.length?Promise.all(i).then(()=>n):n}});function Ts(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...$t(r,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var Sx=[];function gh(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Sx,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Da(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function yh(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,p=u.optout,f=0;for(let h in t){if(i&&r.issues.length!==f){if(nt(r,f))break;f=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let m=u.run({value:t[h],issues:[]},n);m instanceof Promise?e.push(m.then(y=>Ts(y,r,h,t,d,p))):Ts(m,r,h,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var zx=b("$ZodObject",(e,t)=>{Q.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=Dr(()=>gh(t));G(e,"propValues",u=>{let l=u.def.shape,d={};for(let p in l){let f=l[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,p)||Ve(d,p,new Set);for(let h of f.values)d[p].add(h);f.optin!==void 0&&d[p].add(void 0)}}return d});let s=cr,i=t.catchall,a,c=Ze.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],f=a.shape,h=l?.abortEarly,m=u.issues.length;for(let y of a.allKeys){if(h&&u.issues.length!==m){if(nt(u,m))break;m=u.issues.length}if(y==="__proto__")continue;let _=f[y],v=_._zod.optin,$=_._zod.optout,C=_._zod.run({value:d[y],issues:[]},l);C instanceof Promise?p.push(C.then(w=>Ts(w,u,y,d,v,$))):Ts(C,u,y,d,v,$)}return i?yh(p,d,u,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>u):u}}),_h=b("$ZodObjectJIT",(e,t)=>{zx.init(e,t);let r=e._zod.parse,n=Dr(()=>gh(t)),o=Ze.memoizer,s=f=>{let h=n.value,m=h.symbolKeys,y=new ks(["payload","ctx"],{shape:f,inst:e,memo:o,syms:m}),_=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,v=(w,x)=>`
|
|
18
|
+
let ${w}_ab = false;
|
|
19
|
+
for (let i = 0; i < ${w}.issues.length; i++) {
|
|
20
|
+
const iss = ${w}.issues[i];
|
|
21
21
|
iss.path = iss.path ? [${x}, ...iss.path] : [${x}];
|
|
22
22
|
payload.issues.push(iss);
|
|
23
|
-
if (iss.continue !== true) ${
|
|
23
|
+
if (iss.continue !== true) ${w}_ab = true;
|
|
24
24
|
}
|
|
25
|
-
if (${
|
|
25
|
+
if (${w}_ab && ctx && ctx.abortEarly) {
|
|
26
26
|
payload.value = newResult;
|
|
27
27
|
return payload;
|
|
28
|
-
}`;y.write("const input = payload.value;");let
|
|
29
|
-
const ${x}_present = ${
|
|
28
|
+
}`;y.write("const input = payload.value;");let $=Object.create(null),C=0;for(let w of h.allKeys)$[w]=`key_${C++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of h.allKeys){if(w==="__proto__")continue;let x=$[w],E=typeof w=="symbol"?`syms[${m.indexOf(w)}]`:Ia(w),W=`${E} in input`,D=f[w],S=D?._zod?.optin,T=S!==void 0,M=D?._zod?.optout==="optional";if(y.write(`const ${x} = ${_(E)};`),T&&M){let F=S==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;y.write(`
|
|
29
|
+
const ${x}_present = ${W};
|
|
30
30
|
if (!${x}.issues.length || ${x}_present) {
|
|
31
|
-
if (${x}.issues.length) {${v(x
|
|
31
|
+
if (${x}.issues.length) {${v(x,E)}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
if (${
|
|
35
|
-
newResult[${
|
|
34
|
+
if (${F}) {
|
|
35
|
+
newResult[${E}] = ${x}.value;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
`)}else
|
|
40
|
-
if (${x}.issues.length) {${v(x
|
|
39
|
+
`)}else T?(y.write(`
|
|
40
|
+
if (${x}.issues.length) {${v(x,E)}
|
|
41
41
|
}
|
|
42
|
-
`),
|
|
43
|
-
if (${x}.value !== undefined || ${
|
|
44
|
-
newResult[${
|
|
42
|
+
`),S==="defaulted"?y.write(`newResult[${E}] = ${x}.value;`):y.write(`
|
|
43
|
+
if (${x}.value !== undefined || ${W}) {
|
|
44
|
+
newResult[${E}] = ${x}.value;
|
|
45
45
|
}
|
|
46
46
|
`)):y.write(`
|
|
47
|
-
const ${x}_present = ${
|
|
48
|
-
if (${x}.issues.length) {${v(x
|
|
47
|
+
const ${x}_present = ${W};
|
|
48
|
+
if (${x}.issues.length) {${v(x,E)}
|
|
49
49
|
}
|
|
50
50
|
if (!${x}_present && !${x}.issues.length) {
|
|
51
51
|
payload.issues.push({
|
|
52
52
|
code: "invalid_type",
|
|
53
53
|
expected: "nonoptional",
|
|
54
54
|
input: undefined,
|
|
55
|
-
path: [${
|
|
55
|
+
path: [${E}]
|
|
56
56
|
});
|
|
57
57
|
if (ctx && ctx.abortEarly) {
|
|
58
58
|
payload.value = newResult;
|
|
@@ -61,26 +61,30 @@ ${r.join(`
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (${x}_present) {
|
|
64
|
-
newResult[${
|
|
64
|
+
newResult[${E}] = ${x}.value;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},i,a=ar,c=!Ie.jitless,l=c&&Na.value,d=t.catchall,p;e._zod.parse=(f,h)=>{p??(p=n.value);let m=f.value;return a(m)?c&&l&&h?.async===!1&&h.jitless!==!0?(i||(i=s(t.shape)),f=i(f,h),d?hh([],m,f,h,p,e,h?.abortEarly===!0):f):r(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function vp(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!Qe(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>et(i,n,Ne())))}),t)}var oc=b("$ZodUnion",(e,t)=>{W.init(e,t),H(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),H(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),H(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Tn(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>vp(a,n,e,o)):vp(i,n,e,o)}});function $x(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var gh=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,oc.init(e,t);let r=e._zod.parse;H(e,"propValues",o=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||qe(s,u,new Set);for(let d of l)s[u].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{let i=Zr(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let n=jr(()=>$x(t));e._zod.parse=(o,s)=>{let i=o.value;if(!ar(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),yh=b("$ZodIntersection",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>$p(r,c,u)):$p(r,s,i)}});function ec(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(Dt(e)&&Dt(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=ec(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=ec(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function $p(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);s.has(p)||s.set(p,u),d=[p]}else return!1;for(let p of d)n.has(p)||n.set(p,{}),n.get(p)[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 a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=ec(t.value,r.value);if(!c.valid){if(Qe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var _h=b("$ZodRecord",(e,t)=>{W.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Dt(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>et(h,o,Ne())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...vt(l,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...vt(l,f.issues)),n.value[p]=f.value)}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;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:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&In.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=s[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>et(h,o,Ne())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[u],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...vt(u,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...vt(u,f.issues)),n.value[p]=f.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}});var bh=b("$ZodEnum",(e,t)=>{W.init(e,t);let r=Ir(t.entries),n=new Set(r);e._zod.values=n,H(e,"pattern",o=>{let s=Ir(o.def.entries).filter(i=>ja.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>xt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),wh=b("$ZodLiteral",(e,t)=>{W.init(e,t);let r=new Set(t.values);e._zod.values=r,H(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?xt(s):s?xt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var xh=b("$ZodTransform",(e,t)=>{W.init(e,t),e._zod.optin="optional",Ie.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new tt;return r.value=o,r}});function Sp(e,t){return e.value=t.issues.length?void 0:t.value,e}var sc=b("$ZodOptional",(e,t)=>{W.init(e,t),H(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",H(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),H(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Tn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Sp(r,s)):Sp(r,o)}return t.innerType._zod.run(r,n)}}),vh=b("$ZodExactOptional",(e,t)=>{sc.init(e,t),H(e,"values",r=>r.def.innerType._zod.values),H(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),$h=b("$ZodNullable",(e,t)=>{W.init(e,t),H(e,"optin",r=>r.def.innerType._zod.optin),H(e,"optout",r=>r.def.innerType._zod.optout),H(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Tn(n.source)}|null)$`):void 0}),H(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Sh=b("$ZodDefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",H(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>zp(s,t)):zp(o,t)}});function zp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var zh=b("$ZodPrefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",H(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),kh=b("$ZodNonOptional",(e,t)=>{W.init(e,t),H(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>kp(s,e)):kp(o,e)}});function kp(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 Pp(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>et(o,n,Ne()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Ph=b("$ZodCatch",(e,t)=>{W.init(e,t),H(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),H(e,"optout",r=>r.def.innerType._zod.optout),H(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Pp(r,s,t,n)):Pp(r,o,t,n)}});var ic=b("$ZodPipe",(e,t)=>{W.init(e,t),H(e,"values",r=>r.def.in._zod.values),H(e,"optin",r=>r.def.in._zod.optin),H(e,"optout",r=>r.def.out._zod.optout),H(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Ss(i,t.in,n)):Ss(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Ss(s,t.out,n)):Ss(o,t.out,n)}});function Ss(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Eh=b("$ZodPreprocess",(e,t)=>{ic.init(e,t)}),Th=b("$ZodReadonly",(e,t)=>{W.init(e,t),H(e,"propValues",r=>r.def.innerType._zod.propValues),H(e,"values",r=>r.def.innerType._zod.values),H(e,"optin",r=>r.def.innerType?._zod?.optin),H(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Ep):Ep(o)}});function Ep(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Oh=b("$ZodCustom",(e,t)=>{_e.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Tp(s,r,n,e));Tp(o,r,n,e)}});function Tp(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Dr(o))}}var cc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},uc="~memo",Rh=[];function Ah(e){return e!==null&&typeof e=="object"}function ac(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Ch=new WeakMap,jn=0,Rs=1,Zn=2;function As(e,t,r){let n=Ch.get(e);if(n!==void 0)return n?Zn:jn;if(t.has(e))return Zn;t.add(e);let o=jn,s=l=>{if(o!==Zn&&l?._zod){let d=As(l,t,r);d>o&&(o=d)}},i=(l,d)=>{let p=jn;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(d&&!h.enumerable)continue;let m=h.get?Rs:h.value?._zod?As(h.value,t,r):jn;m>p&&(p=m)}return p},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Zr(c);a(l?i(l,!0):Rs),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?As(l,t,!1):Rs);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 c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(let f of p)s(f)}}}return t.delete(e),Sx(e,o)}function Sx(e,t){return t!==Rs&&Ch.set(e,t===Zn),t}function zx(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Ts,Os=[],kx={alloc(e,t,r){let n=Ts;if(!n)return r;Ts=void 0;let o={value:r,issues:null};return n.set(t.value,o),Os.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&Px(s,o.value))throw new cc;return r(o,s)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let w=As(e,new Set,!1);if(w===jn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);w===Zn||n?r=!0:n=!0}let l=c.value;if(!Ah(l))return i(c,u);let d=u[uc];d||(d={buckets:new WeakMap,backEdges:void 0},u[uc]=d);let p;o===u?p=s:(p=zx(d,e),o=u,s=p);let f=p.get(l);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...ac(f.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),c;Ts=p;let h=Os.length,m=i(c,u);Ts=void 0;let y=Os.length>h?Os.pop():void 0;return m instanceof Promise?m.then(w=>(y&&(y.issues=w.issues.length?ac(w.issues):Rh),w)):(y&&(y.issues=m.issues.length?ac(m.issues):Rh),m)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function lc(){return kx}function Px(e,t){let r=e[uc]?.backEdges;return r!==void 0&&Ah(t)&&r.has(t)}var Ex=()=>{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"},n={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):n[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=Ma(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${ds(s.values[0])}`:`Invalid option: expected one of ${us(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.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":""}: ${us(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(a=>`'${a}'`).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 Ih(){return{localeError:Ex()}}var Nh;var dc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.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 n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function jh(){return new dc}(Nh=globalThis).__zod_globalRegistry??(Nh.__zod_globalRegistry=jh());var Mt=globalThis.__zod_globalRegistry;function Cs(e){return e.checks&&(e.checks=[...e.checks]),e}function Zh(e,t){return new e(Cs({type:"string",...I(t)}))}function Dh(e,t){return new e(Cs({type:"string",coerce:!0,...I(t)}))}function Mh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function Lh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Uh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function qh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function Bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function fc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function Vh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function Hh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Kh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function Jh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Wh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Gh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function Xh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function Yh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function Qh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function em(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function tm(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function rm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function nm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function om(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function sm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Is(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ns(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function js(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Zs(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function im(e,t){return new e(Cs({type:"number",checks:[],...I(t)}))}function am(e,t){return new e(Cs({type:"number",coerce:!0,checks:[],...I(t)}))}function cm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function um(e,t){return new e({type:"boolean",...I(t)})}function lm(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function dm(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function fm(e,t){return new e({type:"null",...I(t)})}function pm(e){return new e({type:"any"})}function hm(e){return new e({type:"unknown"})}function mm(e,t){return new e({type:"never",...I(t)})}function gm(e,t){return new e({type:"date",coerce:!0,...I(t)})}function Ur(e,t){return new Ya({check:"less_than",...I(t),value:e,inclusive:!1})}function $t(e,t){return new Ya({check:"less_than",...I(t),value:e,inclusive:!0})}function qr(e,t){return new Qa({check:"greater_than",...I(t),value:e,inclusive:!1})}function St(e,t){return new Qa({check:"greater_than",...I(t),value:e,inclusive:!0})}function Dn(e,t){return new ip({check:"multiple_of",...I(t),value:e})}function Ds(e,t){return new cp({check:"max_length",...I(t),maximum:e})}function Fr(e,t){return new up({check:"min_length",...I(t),minimum:e})}function Ms(e,t){return new lp({check:"length_equals",...I(t),length:e})}function pc(e,t){return new dp({check:"string_format",format:"regex",...I(t),pattern:e})}function hc(e){return new fp({check:"string_format",format:"lowercase",...I(e)})}function mc(e){return new pp({check:"string_format",format:"uppercase",...I(e)})}function gc(e,t){return new hp({check:"string_format",format:"includes",...I(t),includes:e})}function yc(e,t){return new mp({check:"string_format",format:"starts_with",...I(t),prefix:e})}function _c(e,t){return new gp({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Lt(e){return new yp({check:"overwrite",tx:e})}function bc(e){return Lt(t=>t.normalize(e))}function wc(){return Lt(e=>e.trim())}function xc(){return Lt(e=>e.toLowerCase())}function vc(){return Lt(e=>e.toUpperCase())}function $c(){return Lt(e=>Ia(e))}function ym(e,t,r){return new e({type:"array",element:t,...I(r)})}function _m(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function bm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function wm(e,t){let r=Tx(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Dr(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Dr(s))}},e(n.value,n)),t);return r}function Tx(e,t){let r=new _e({check:"custom",...I(t)});return r._zod.check=e,r}function Mn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&qe(e,n,r[n]);return e}function zc(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??Mt,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 rt(e,t,r,n,o){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(r,s),!0}function le(e,t,r={path:[],schemaPath:[]}){var n;let o=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 a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),le(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Mn(i.schema,c),t.io==="input"&&Oe(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function xm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function kc(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 n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(h=>h);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${xm(f)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+xm(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
67
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},i,a=cr,c=!Ze.jitless,l=c&&ja.value,d=t.catchall,p;e._zod.parse=(f,h)=>{p??(p=n.value);let m=f.value;return a(m)?c&&l&&h?.async===!1&&h.jitless!==!0?(i||(i=s(t.shape)),f=i(f,h),d?yh([],m,f,h,p,e,h?.abortEarly===!0):f):r(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function zp(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!nt(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>ot(i,n,De())))}),t)}var sc=b("$ZodUnion",(e,t)=>{Q.init(e,t),G(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),G(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),G(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),G(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Rn(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>zp(a,n,e,o)):zp(i,n,e,o)}});function kx(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var bh=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,sc.init(e,t);let r=e._zod.parse;G(e,"propValues",o=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||Ve(s,u,new Set);for(let d of l)s[u].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{let i=Mr(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let n=Dr(()=>kx(t));e._zod.parse=(o,s)=>{let i=o.value;if(!cr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),wh=b("$ZodIntersection",(e,t)=>{Q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>kp(r,c,u)):kp(r,s,i)}});function tc(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(Mt(e)&&Mt(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=tc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=tc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function kp(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);s.has(p)||s.set(p,u),d=[p]}else return!1;for(let p of d)n.has(p)||n.set(p,{}),n.get(p)[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 a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=tc(t.value,r.value);if(!c.valid){if(nt(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var xh=b("$ZodRecord",(e,t)=>{Q.init(e,t);let r=Ze.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Mt(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>ot(h,o,De())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...$t(l,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...$t(l,f.issues)),n.value[p]=f.value)}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;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:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&jn.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=s[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>ot(h,o,De())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[u],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...$t(u,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...$t(u,f.issues)),n.value[p]=f.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}});var vh=b("$ZodEnum",(e,t)=>{Q.init(e,t);let r=jr(t.entries),n=new Set(r);e._zod.values=n,G(e,"pattern",o=>{let s=jr(o.def.entries).filter(i=>Za.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>vt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),$h=b("$ZodLiteral",(e,t)=>{Q.init(e,t);let r=new Set(t.values);e._zod.values=r,G(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?vt(s):s?vt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Sh=b("$ZodTransform",(e,t)=>{Q.init(e,t),e._zod.optin="optional",Ze.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ur(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new st;return r.value=o,r}});function Pp(e,t){return e.value=t.issues.length?void 0:t.value,e}var ic=b("$ZodOptional",(e,t)=>{Q.init(e,t),G(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",G(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),G(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Rn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Pp(r,s)):Pp(r,o)}return t.innerType._zod.run(r,n)}}),zh=b("$ZodExactOptional",(e,t)=>{ic.init(e,t),G(e,"values",r=>r.def.innerType._zod.values),G(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),kh=b("$ZodNullable",(e,t)=>{Q.init(e,t),G(e,"optin",r=>r.def.innerType._zod.optin),G(e,"optout",r=>r.def.innerType._zod.optout),G(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Rn(n.source)}|null)$`):void 0}),G(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Ph=b("$ZodDefault",(e,t)=>{Q.init(e,t),e._zod.optin="defaulted",G(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ep(s,t)):Ep(o,t)}});function Ep(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Eh=b("$ZodPrefault",(e,t)=>{Q.init(e,t),e._zod.optin="defaulted",G(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Th=b("$ZodNonOptional",(e,t)=>{Q.init(e,t),G(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Tp(s,e)):Tp(o,e)}});function Tp(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 Op(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ot(o,n,De()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Oh=b("$ZodCatch",(e,t)=>{Q.init(e,t),G(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),G(e,"optout",r=>r.def.innerType._zod.optout),G(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Op(r,s,t,n)):Op(r,o,t,n)}});var ac=b("$ZodPipe",(e,t)=>{Q.init(e,t),G(e,"values",r=>r.def.in._zod.values),G(e,"optin",r=>r.def.in._zod.optin),G(e,"optout",r=>r.def.out._zod.optout),G(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Ps(i,t.in,n)):Ps(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Ps(s,t.out,n)):Ps(o,t.out,n)}});function Ps(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Rh=b("$ZodPreprocess",(e,t)=>{ac.init(e,t)}),Ah=b("$ZodReadonly",(e,t)=>{Q.init(e,t),G(e,"propValues",r=>r.def.innerType._zod.propValues),G(e,"values",r=>r.def.innerType._zod.values),G(e,"optin",r=>r.def.innerType?._zod?.optin),G(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Rp):Rp(o)}});function Rp(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Ch=b("$ZodCustom",(e,t)=>{xe.init(e,t),Q.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Ap(s,r,n,e));Ap(o,r,n,e)}});function Ap(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Lr(o))}}var uc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},lc="~memo",Ih=[];function Nh(e){return e!==null&&typeof e=="object"}function cc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var jh=new WeakMap,Dn=0,Is=1,Mn=2;function Ns(e,t,r){let n=jh.get(e);if(n!==void 0)return n?Mn:Dn;if(t.has(e))return Mn;t.add(e);let o=Dn,s=l=>{if(o!==Mn&&l?._zod){let d=Ns(l,t,r);d>o&&(o=d)}},i=(l,d)=>{let p=Dn;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(d&&!h.enumerable)continue;let m=h.get?Is:h.value?._zod?Ns(h.value,t,r):Dn;m>p&&(p=m)}return p},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Mr(c);a(l?i(l,!0):Is),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Ns(l,t,!1):Is);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 c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(let f of p)s(f)}}}return t.delete(e),Px(e,o)}function Px(e,t){return t!==Is&&jh.set(e,t===Mn),t}function Ex(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var As,Cs=[],Tx={alloc(e,t,r){let n=As;if(!n)return r;As=void 0;let o={value:r,issues:null};return n.set(t.value,o),Cs.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&Ox(s,o.value))throw new uc;return r(o,s)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let _=Ns(e,new Set,!1);if(_===Dn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);_===Mn||n?r=!0:n=!0}let l=c.value;if(!Nh(l))return i(c,u);let d=u[lc];d||(d={buckets:new WeakMap,backEdges:void 0},u[lc]=d);let p;o===u?p=s:(p=Ex(d,e),o=u,s=p);let f=p.get(l);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...cc(f.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),c;As=p;let h=Cs.length,m=i(c,u);As=void 0;let y=Cs.length>h?Cs.pop():void 0;return m instanceof Promise?m.then(_=>(y&&(y.issues=_.issues.length?cc(_.issues):Ih),_)):(y&&(y.issues=m.issues.length?cc(m.issues):Ih),m)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function dc(){return Tx}function Ox(e,t){let r=e[lc]?.backEdges;return r!==void 0&&Nh(t)&&r.has(t)}var Rx=()=>{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"},n={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):n[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=La(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${hs(s.values[0])}`:`Invalid option: expected one of ${fs(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.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":""}: ${fs(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(a=>`'${a}'`).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 Zh(){return{localeError:Rx()}}var Dh;var fc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.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 n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Mh(){return new fc}(Dh=globalThis).__zod_globalRegistry??(Dh.__zod_globalRegistry=Mh());var Lt=globalThis.__zod_globalRegistry;function js(e){return e.checks&&(e.checks=[...e.checks]),e}function Lh(e,t){return new e(js({type:"string",...I(t)}))}function Uh(e,t){return new e(js({type:"string",coerce:!0,...I(t)}))}function qh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function Fh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function Vh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Hh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function Kh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function pc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function Jh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function Wh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Gh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function Xh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Yh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Qh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function em(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function tm(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function rm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function nm(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function om(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function sm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function im(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function am(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function cm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Zs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ds(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Ms(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Ls(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function um(e,t){return new e(js({type:"number",checks:[],...I(t)}))}function lm(e,t){return new e(js({type:"number",coerce:!0,checks:[],...I(t)}))}function dm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function fm(e,t){return new e({type:"boolean",...I(t)})}function pm(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function hm(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function mm(e,t){return new e({type:"null",...I(t)})}function gm(e){return new e({type:"any"})}function ym(e){return new e({type:"unknown"})}function _m(e,t){return new e({type:"never",...I(t)})}function bm(e,t){return new e({type:"date",coerce:!0,...I(t)})}function Fr(e,t){return new Qa({check:"less_than",...I(t),value:e,inclusive:!1})}function St(e,t){return new Qa({check:"less_than",...I(t),value:e,inclusive:!0})}function Br(e,t){return new ec({check:"greater_than",...I(t),value:e,inclusive:!1})}function zt(e,t){return new ec({check:"greater_than",...I(t),value:e,inclusive:!0})}function Ln(e,t){return new up({check:"multiple_of",...I(t),value:e})}function Us(e,t){return new dp({check:"max_length",...I(t),maximum:e})}function Vr(e,t){return new fp({check:"min_length",...I(t),minimum:e})}function qs(e,t){return new pp({check:"length_equals",...I(t),length:e})}function hc(e,t){return new hp({check:"string_format",format:"regex",...I(t),pattern:e})}function mc(e){return new mp({check:"string_format",format:"lowercase",...I(e)})}function gc(e){return new gp({check:"string_format",format:"uppercase",...I(e)})}function yc(e,t){return new yp({check:"string_format",format:"includes",...I(t),includes:e})}function _c(e,t){return new _p({check:"string_format",format:"starts_with",...I(t),prefix:e})}function bc(e,t){return new bp({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Ut(e){return new wp({check:"overwrite",tx:e})}function wc(e){return Ut(t=>t.normalize(e))}function xc(){return Ut(e=>e.trim())}function vc(){return Ut(e=>e.toLowerCase())}function $c(){return Ut(e=>e.toUpperCase())}function Sc(){return Ut(e=>Na(e))}function wm(e,t,r){return new e({type:"array",element:t,...I(r)})}function xm(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function vm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function $m(e,t){let r=Ax(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Lr(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Lr(s))}},e(n.value,n)),t);return r}function Ax(e,t){let r=new xe({check:"custom",...I(t)});return r._zod.check=e,r}function Un(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Ve(e,n,r[n]);return e}function kc(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??Lt,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 it(e,t,r,n,o){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(r,s),!0}function he(e,t,r={path:[],schemaPath:[]}){var n;let o=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 a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),he(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Un(i.schema,c),t.io==="input"&&Ce(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Sm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pc(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 n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(h=>h);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${Sm(f)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Sm(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
68
68
|
|
|
69
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=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(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Sm(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Sm(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.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 zm=new Set(["type","properties","required","additionalProperties"]),vm=["oneOf","anyOf"];function $m(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Sc(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!zm.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??$m(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Sc(a)??{allOf:a};qe(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=$m(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function Ox(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of zm)if(o in e)return;let r=t.filter(o=>vm.some(s=>Array.isArray(o[s]))),n=null;if(!r.length)n=Sc(t);else{let o=r[0],s=vm.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter(c=>c!==o),a=o[s].map(c=>Sc([...i,c]));if(a.some(c=>!c))return;n={[s]:a}}n&&(delete e.allOf,Mn(e,n))}function Pc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Mn(u,h),Mn(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(h.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==d){n(p);let f=e.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let h in u)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Sm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Ox(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Mn(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,qe(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ln(t,"input",e.processors),output:Ln(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Oe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Oe(n.element,r);if(n.type==="set")return Oe(n.valueType,r);if(n.type==="lazy")return Oe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Oe(n.innerType,r);if(n.type==="intersection")return Oe(n.left,r)||Oe(n.right,r);if(n.type==="record"||n.type==="map")return Oe(n.keyType,r)||Oe(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Oe(n.in,r)||Oe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Oe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Oe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Oe(o,r))return!0;return!!(n.rest&&Oe(n.rest,r))}return!1}var km=(e,t={})=>r=>{let n=zc({...r,processors:t});return le(e,n),kc(n,e),Pc(n,e)},Ln=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=zc({...o??{},target:s,io:t,processors:r});return le(e,i),kc(i,e),Pc(i,e)};var Br=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Vr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Pm=(e,t)=>{Br(e,"minimum",t),Vr(e,"maximum",t)},Rm=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Am=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Cm=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Im=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Em=(e,t)=>Br(e,"minimum",t.minimum),Tm=(e,t)=>Vr(e,"maximum",t.maximum),Om=e=>(t,r)=>{Im(t,r.format);let[n,o]=e[r.format];Br(t,"minimum",n),Vr(t,"maximum",o)},Rx={greater_than:(e,t)=>Br(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Vr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Rm(e,t.value),number_format:Om(On),bigint_format:Om(fs),min_length:Em,max_length:Tm,length_equals:(e,t)=>Pm(e,t.length),min_size:Em,max_size:Tm,size_equals:(e,t)=>Pm(e,t.size),string_format:(e,t)=>{Im(e,t.format),t.pattern&&Am(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)=>Cm(e,t.mime)};function be(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Rx[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Br(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Br(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Vr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Vr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Rm(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Cm(t,o.mime);for(let s of o.patterns??[])Am(t,s);return t}var Ax={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cx=new Map([[rc,Hf],[Es,Kf]]),Nm=e=>Cx.get(e)??e,jm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=be(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Ax[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let d=[...c].map(Nm);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Zm=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=be(e);o.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),p?f?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i=="number"&&(o.maximum=i),a){let h=new Set;for(let w of a)Number.isFinite(w)&&w!==0?h.add(Math.abs(w)):rt(e,t,o,n,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[m,...y]=h;m!==void 0&&(o.multipleOf=m),y.length&&(o.allOf=[...o.allOf??[],...y.map(w=>({multipleOf:w}))])}},Dm=(e,t,r,n)=>{r.type="boolean"},Mm=(e,t,r,n)=>{rt(e,t,r,n,"BigInt cannot be represented in JSON Schema")};var Lm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Um=(e,t,r,n)=>{r.not={}},qm=(e,t,r,n)=>{},Fm=(e,t,r,n)=>{},Bm=(e,t,r,n)=>{rt(e,t,r,n,"Date cannot be represented in JSON Schema")},Vm=(e,t,r,n)=>{let o=e._zod.def,s=Ir(o.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},Hm=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(rt(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(rt(e,t,r,n,"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};var Km=(e,t,r,n)=>{rt(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Jm=(e,t,r,n)=>{rt(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Wm=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=be(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=le(s.element,t,{...n,path:[...n.path,"items"]})};function Ls(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ls(t.out):t.type==="catch"?Ls(t.innerType):e._zod.optin}var Gm=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&rt(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)qe(o.properties,u,le(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?Ls(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=le(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Xm=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>le(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Ym=(e,t,r,n)=>{let o=e._zod.def,s=le(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=le(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function Ec(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let m=Ec(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let y=m.map(w=>Ec(e,w,r));y.some((w,v)=>w!==m[v])&&(t={...t,[h]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(h=>typeof h=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:p,...f}=t;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?In:Ga).source)),f}var Tc=new WeakMap;function Ix(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Tc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Ec(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);s&&(o.propertyNames=s)}}var Qm=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=be(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=le(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)qe(o.patternProperties,Nm(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=le(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Tc.get(t);l||(l=[],Tc.set(t,l),t.deferred.push(()=>Ix(t))),l.push(e)}o.additionalProperties=le(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Ls(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},eg=(e,t,r,n)=>{let o=e._zod.def,s=le(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},tg=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Oc=Symbol();function rg(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(rt(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Oc):JSON.parse(i)}var ng=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=rg(o.defaultValue,e,t,r,n);i!==Oc&&(r.default=i)},og=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=rg(o.defaultValue,e,t,r,n);i!==Oc&&(r._prefault=i)},sg=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{rt(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},ig=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;le(i,t,n);let a=t.seen.get(e);a.ref=i},ag=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Rc=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function Us(e){return!!e._zod}function Re(e,t){return Us(e)?Ka(e,t):e.safeParse(t)}function Kr(e){if(!e)return;let t;if(Us(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Jr(e){if(Us(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 n=e.value;if(n!==void 0)return n}var cg=new WeakSet([Object.prototype,Error.prototype]);function qs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Bx=(e,t)=>{wf.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);cg.has(r)||(cg.add(r),qs(r,"format",n=>o=>Ha(n,o)),qs(r,"flatten",n=>o=>Va(n,o)),qs(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Nr,2)}),qs(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Nr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Fe=b("ZodError",Bx,void 0,{Parent:Error});var ug=ys(Fe),lg=_s(Fe),dg=Cn(Fe),fg=bs(Fe),pg=$f(Fe),hg=Sf(Fe),mg=zf(Fe),gg=kf(Fe),yg=Pf(Fe),_g=Ef(Fe),bg=Tf(Fe),wg=Of(Fe);function Hx(){Ie.localeError||Ne(Ih())}function Bs(){Ie.memoizer||Ne({memoizer:lc()})}var X=b("ZodType",(e,t)=>(Hx(),W.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(j.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 Ve(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Cv(e,t))},superRefine(e,t){return this.check(Iv(e,t))},overwrite(e){return this.check(Lt(e))},optional(){return ae(this)},exactOptional(){return xv(this)},nullable(){return $g(this)},nullish(){return ae($g(this))},nonoptional(e){return Pv(this,e)},array(){return z(this)},or(e){return re([this,e])},and(e){return Hs(this,e)},transform(e){return Sg(this,Ig(e))},default(e){return Sv(this,e)},prefault(e){return kv(this,e)},catch(e){return Tv(this,e)},pipe(e){return Sg(this,e)},readonly(){return Av(this)},describe(e){let t=this.clone();return Mt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Mt.get(this);let t=this.clone();return Mt.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 j.hide(this,"~standard",{...tc(this),jsonSchema:{input:Ln(this,"input"),output:Ln(this,"output")}})},set"~standard"(e){j.own(this,"~standard",e)},parse:function e(t,r){return ug(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await lg(this,t,r,{callee:e})},safeParse(e,t){return dg(this,e,t)},async safeParseAsync(e,t){return fg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){j.own(this,"spa",e)},validate(e,t){return ws(this,e,t)},validateAsync(e,t){return xs(this,e,t)},encode:function e(t,r){return pg(this,t,r,{callee:e})},decode:function e(t,r){return hg(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await mg(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await gg(this,t,r,{callee:e})},safeEncode(e,t){return yg(this,e,t)},safeDecode(e,t){return _g(this,e,t)},async safeEncodeAsync(e,t){return bg(this,e,t)},async safeDecodeAsync(e,t){return wg(this,e,t)},toJSONSchema(e){return km(this,{})(e)},get description(){return Mt.get(this)?.description},get _def(){return this._zod.def}}),zg=b("_ZodString",(e,t)=>{Ps.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jm(e,r,n,o)},j.derived({format:e=>be(e).format??null,minLength:e=>be(e).minimum??null,maxLength:e=>be(e).maximum??null},{regex(...e){return this.check(pc(...e))},includes(...e){return this.check(gc(...e))},startsWith(...e){return this.check(yc(...e))},endsWith(...e){return this.check(_c(...e))},min(...e){return this.check(Fr(...e))},max(...e){return this.check(Ds(...e))},length(...e){return this.check(Ms(...e))},nonempty(...e){return this.check(Fr(1,...e))},lowercase(e){return this.check(hc(e))},uppercase(e){return this.check(mc(e))},trim(){return this.check(wc())},normalize(...e){return this.check(bc(...e))},toLowerCase(){return this.check(xc())},toUpperCase(){return this.check(vc())},slugify(){return this.check($c())}})),Cc=b("ZodString",(e,t)=>{Ps.init(e,t),zg.init(e,t)},{email(e){return this.check(Mh(Kx,e))},url(e){return this.check(fc(kg,e))},jwt(e){return this.check(sm(uv,e))},emoji(e){return this.check(Vh(Wx,e))},guid(e){return this.check(Lh(Jx,e))},uuid(e){return this.check(Uh(Fs,e))},uuidv4(e){return this.check(qh(Fs,e))},uuidv6(e){return this.check(Fh(Fs,e))},uuidv7(e){return this.check(Bh(Fs,e))},nanoid(e){return this.check(Hh(Gx,e))},cuid(e){return this.check(Kh(Xx,e))},cuid2(e){return this.check(Jh(Yx,e))},ulid(e){return this.check(Wh(Qx,e))},base64(e){return this.check(rm(iv,e))},base64url(e){return this.check(nm(av,e))},xid(e){return this.check(Gh(ev,e))},ksuid(e){return this.check(Xh(tv,e))},ipv4(e){return this.check(Yh(rv,e))},ipv6(e){return this.check(Qh(nv,e))},cidrv4(e){return this.check(em(ov,e))},cidrv6(e){return this.check(tm(sv,e))},e164(e){return this.check(om(cv,e))},datetime(e){return this.check(Is(Un,e))},date(e){return this.check(Ns(qn,e))},time(e){return this.check(js(Fn,e))},duration(e){return this.check(Zs(Bn,e))}});function g(e){return Zh(Cc,e)}var ce=b("ZodStringFormat",(e,t)=>{te.init(e,t),zg.init(e,t)}),Un=b("ZodISODateTime",(e,t)=>{Bp.init(e,t),ce.init(e,t)}),qn=b("ZodISODate",(e,t)=>{Vp.init(e,t),ce.init(e,t)}),Fn=b("ZodISOTime",(e,t)=>{Hp.init(e,t),ce.init(e,t)}),Bn=b("ZodISODuration",(e,t)=>{Kp.init(e,t),ce.init(e,t)}),Kx=b("ZodEmail",(e,t)=>{Cp.init(e,t),ce.init(e,t)});var Jx=b("ZodGUID",(e,t)=>{Rp.init(e,t),ce.init(e,t)});var Fs=b("ZodUUID",(e,t)=>{Ap.init(e,t),ce.init(e,t)});var kg=b("ZodURL",(e,t)=>{jp.init(e,t),ce.init(e,t)});function Pg(e){return fc(kg,e)}var Wx=b("ZodEmoji",(e,t)=>{Zp.init(e,t),ce.init(e,t)});var Gx=b("ZodNanoID",(e,t)=>{Dp.init(e,t),ce.init(e,t)});var Xx=b("ZodCUID",(e,t)=>{Mp.init(e,t),ce.init(e,t)});var Yx=b("ZodCUID2",(e,t)=>{Lp.init(e,t),ce.init(e,t)});var Qx=b("ZodULID",(e,t)=>{Up.init(e,t),ce.init(e,t)});var ev=b("ZodXID",(e,t)=>{qp.init(e,t),ce.init(e,t)});var tv=b("ZodKSUID",(e,t)=>{Fp.init(e,t),ce.init(e,t)});var rv=b("ZodIPv4",(e,t)=>{Jp.init(e,t),ce.init(e,t)});var nv=b("ZodIPv6",(e,t)=>{Gp.init(e,t),ce.init(e,t)});var ov=b("ZodCIDRv4",(e,t)=>{Xp.init(e,t),ce.init(e,t)});var sv=b("ZodCIDRv6",(e,t)=>{Yp.init(e,t),ce.init(e,t)});var iv=b("ZodBase64",(e,t)=>{eh.init(e,t),ce.init(e,t)});var av=b("ZodBase64URL",(e,t)=>{th.init(e,t),ce.init(e,t)});var cv=b("ZodE164",(e,t)=>{rh.init(e,t),ce.init(e,t)});var uv=b("ZodJWT",(e,t)=>{nh.init(e,t),ce.init(e,t)});var Vs=b("ZodNumber",(e,t)=>{nc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zm(e,r,n,o),e.isFinite=!0},j.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=be(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=be(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=be(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>be(e).format??null},{gt(e,t){return this.check(qr(e,t))},gte(e,t){return this.check(St(e,t))},min(e,t){return this.check(St(e,t))},lt(e,t){return this.check(Ur(e,t))},lte(e,t){return this.check($t(e,t))},max(e,t){return this.check($t(e,t))},int(e){return this.check(xg(e))},safe(e){return this.check(xg(e))},positive(e){return this.check(qr(0,e))},nonnegative(e){return this.check(St(0,e))},negative(e){return this.check(Ur(0,e))},nonpositive(e){return this.check($t(0,e))},multipleOf(e,t){return this.check(Dn(e,t))},step(e,t){return this.check(Dn(e,t))},finite(){return this}}));function K(e){return im(Vs,e)}var lv=b("ZodNumberFormat",(e,t)=>{oh.init(e,t),Vs.init(e,t)});function xg(e){return cm(lv,e)}var Ic=b("ZodBoolean",(e,t)=>{sh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dm(e,r,n,o)});function Y(e){return um(Ic,e)}var Eg=b("ZodBigInt",(e,t)=>{ih.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mm(e,r,n,o)},j.derived({minValue:e=>be(e).minimum??null,maxValue:e=>be(e).maximum??null,format:e=>be(e).format??null},{gte(e,t){return this.check(St(e,t))},min(e,t){return this.check(St(e,t))},gt(e,t){return this.check(qr(e,t))},lt(e,t){return this.check(Ur(e,t))},lte(e,t){return this.check($t(e,t))},max(e,t){return this.check($t(e,t))},positive(e){return this.check(qr(BigInt(0),e))},negative(e){return this.check(Ur(BigInt(0),e))},nonpositive(e){return this.check($t(BigInt(0),e))},nonnegative(e){return this.check(St(BigInt(0),e))},multipleOf(e,t){return this.check(Dn(e,t))}}));var dv=b("ZodNull",(e,t)=>{ah.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o)});function Tg(e){return fm(dv,e)}var fv=b("ZodAny",(e,t)=>{ch.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o)});function Og(){return pm(fv)}var pv=b("ZodUnknown",(e,t)=>{uh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o)});function ie(){return hm(pv)}var hv=b("ZodNever",(e,t)=>{lh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Um(e,r,n,o)});function mv(e){return mm(hv,e)}var Rg=b("ZodDate",(e,t)=>{dh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o),e.min=(r,n)=>e.check(St(r,n)),e.max=(r,n)=>e.check($t(r,n))},j.derived({minDate:e=>{let{minimum:t}=be(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=be(e);return t?new Date(t):null}},{}));var gv=b("ZodArray",(e,t)=>{Bs(),fh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Fr(e,t))},nonempty(e){return this.check(Fr(1,e))},max(e,t){return this.check(Ds(e,t))},length(e,t){return this.check(Ms(e,t))},unwrap(){return this.element}});function z(e,t){return ym(gv,e,t)}var Ag=b("ZodObject",(e,t)=>{Bs(),mh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o),j.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return je(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(j.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(j.mergeDefs(this._zod.def,{catchall:ie()}))},loose(){return this.clone(j.mergeDefs(this._zod.def,{catchall:ie()}))},strict(){return this.clone(j.mergeDefs(this._zod.def,{catchall:mv()}))},strip(){return this.clone(j.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return j.extend(this,e)},safeExtend(e){return j.safeExtend(this,e)},merge(e){return j.merge(this,e)},pick(e){return j.pick(this,e)},omit(e){return j.omit(this,e)},partial(...e){return j.partial(Ng,this,e[0])},exactPartial(...e){return j.partial(jg,this,e[0],"exactPartial")},required(...e){return j.required(Zg,this,e[0])}});function k(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new Ag(r)}function pe(e,t){return new Ag({type:"object",shape:e,catchall:ie(),...j.normalizeParams(t)})}var Cg=b("ZodUnion",(e,t)=>{oc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o),e.options=t.options});function re(e,t){return new Cg({type:"union",options:e,...j.normalizeParams(t)})}var yv=b("ZodDiscriminatedUnion",(e,t)=>{Cg.init(e,t),gh.init(e,t)});function Nc(e,t,r){return new yv({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var _v=b("ZodIntersection",(e,t)=>{yh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function Hs(e,t){return new _v({type:"intersection",left:e,right:t})}var vg=b("ZodRecord",(e,t)=>{Bs(),_h.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new vg({type:"record",keyType:g(),valueType:e,...j.normalizeParams(t)}):new vg({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var Ac=b("ZodEnum",(e,t)=>{bh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Vm(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ac({...t,checks:[],...j.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ac({...t,checks:[],...j.normalizeParams(o),entries:s})}});function je(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ac({type:"enum",entries:r,...j.normalizeParams(t)})}var bv=b("ZodLiteral",(e,t)=>{wh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o),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 R(e,t){return new bv({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var wv=b("ZodTransform",(e,t)=>{Bs(),xh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(j.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(j.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Ig(e){return new wv({type:"transform",transform:e})}var Ng=b("ZodOptional",(e,t)=>{sc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new Ng({type:"optional",innerType:e})}var jg=b("ZodExactOptional",(e,t)=>{vh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xv(e){return new jg({type:"optional",innerType:e})}var vv=b("ZodNullable",(e,t)=>{$h.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $g(e){return new vv({type:"nullable",innerType:e})}var $v=b("ZodDefault",(e,t)=>{Sh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ng(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sv(e,t){return new $v({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var zv=b("ZodPrefault",(e,t)=>{zh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>og(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kv(e,t){return new zv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Zg=b("ZodNonOptional",(e,t)=>{kh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pv(e,t){return new Zg({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var Ev=b("ZodCatch",(e,t)=>{Ph.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tv(e,t){return new Ev({type:"catch",innerType:e,catchValue:typeof t=="function"?t:j.constantCatch(t)})}var Dg=b("ZodPipe",(e,t)=>{ic.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ig(e,r,n,o),e.in=t.in,e.out=t.out});function Sg(e,t){return new Dg({type:"pipe",in:e,out:t})}var Ov=b("ZodPreprocess",(e,t)=>{Dg.init(e,t),Eh.init(e,t)}),Rv=b("ZodReadonly",(e,t)=>{Th.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ag(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Av(e){return new Rv({type:"readonly",innerType:e})}var Mg=b("ZodCustom",(e,t)=>{Oh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o)});function Lg(e,t){return _m(Mg,e??(()=>!0),t)}function Cv(e,t={}){return bm(Mg,e,t)}function Iv(e,t){return wm(e,t)}function jc(e,t){return new Ov({type:"pipe",in:Ig(e),out:t})}var qg={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 Ug;Ug||(Ug={});var Ks={};aa(Ks,{ZodISODate:()=>qn,ZodISODateTime:()=>Un,ZodISODuration:()=>Bn,ZodISOTime:()=>Fn,date:()=>Zv,datetime:()=>jv,duration:()=>Mv,time:()=>Dv});function jv(e){return Is(Un,e)}function Zv(e){return Ns(qn,e)}function Dv(e){return js(Fn,e)}function Mv(e){return Zs(Bn,e)}var Js={};aa(Js,{bigint:()=>Fv,boolean:()=>qv,date:()=>Bv,number:()=>Uv,string:()=>Lv});function Lv(e){return Dh(Cc,e)}function Uv(e){return am(Vs,e)}function qv(e){return lm(Ic,e)}function Fv(e){return dm(Eg,e)}function Bv(e){return gm(Rg,e)}var Ut="2025-11-25";var Gs=[Ut,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],qt="io.modelcontextprotocol/related-task",Xs="2.0",he=Lg(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Fg=re([g(),K().int()]),Bg=g(),KC=pe({ttl:K().optional(),pollInterval:K().optional()}),Hv=k({ttl:K().optional()}),Kv=k({taskId:g()}),Dc=pe({progressToken:Fg.optional(),[qt]:Kv.optional()}),Be=k({_meta:Dc.optional()}),Vn=Be.extend({task:Hv.optional()}),Vg=e=>Vn.safeParse(e).success,we=k({method:g(),params:Be.loose().optional()}),He=k({_meta:Dc.optional()}),Ke=k({method:g(),params:He.loose().optional()}),xe=pe({_meta:Dc.optional()}),Ys=re([g(),K().int()]),Hg=k({jsonrpc:R(Xs),id:Ys,...we.shape}).strict(),Hn=e=>Hg.safeParse(e).success,Kg=k({jsonrpc:R(Xs),...Ke.shape}).strict(),Jg=e=>Kg.safeParse(e).success,Mc=k({jsonrpc:R(Xs),id:Ys,result:xe}).strict(),cr=e=>Mc.safeParse(e).success;var N;(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"})(N||(N={}));var Lc=k({jsonrpc:R(Xs),id:Ys.optional(),error:k({code:K().int(),message:g(),data:ie().optional()})}).strict();var Wg=e=>Lc.safeParse(e).success;var Gr=re([Hg,Kg,Mc,Lc]),JC=re([Mc,Lc]),zt=xe.strict(),Jv=He.extend({requestId:Ys.optional(),reason:g().optional()}),Qs=Ke.extend({method:R("notifications/cancelled"),params:Jv}),Wv=k({src:g(),mimeType:g().optional(),sizes:z(g()).optional(),theme:je(["light","dark"]).optional()}),Kn=k({icons:z(Wv).optional()}),Wr=k({name:g(),title:g().optional()}),Gg=Wr.extend({...Wr.shape,...Kn.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),Gv=Hs(k({applyDefaults:Y().optional()}),ee(g(),ie())),Xv=jc(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Hs(k({form:Gv.optional(),url:he.optional()}),ee(g(),ie()).optional())),Yv=pe({list:he.optional(),cancel:he.optional(),requests:pe({sampling:pe({createMessage:he.optional()}).optional(),elicitation:pe({create:he.optional()}).optional()}).optional()}),Qv=pe({list:he.optional(),cancel:he.optional(),requests:pe({tools:pe({call:he.optional()}).optional()}).optional()}),e$=k({experimental:ee(g(),he).optional(),sampling:k({context:he.optional(),tools:he.optional()}).optional(),elicitation:Xv.optional(),roots:k({listChanged:Y().optional()}).optional(),tasks:Yv.optional(),extensions:ee(g(),he).optional()}),t$=Be.extend({protocolVersion:g(),capabilities:e$,clientInfo:Gg}),Uc=we.extend({method:R("initialize"),params:t$});var r$=k({experimental:ee(g(),he).optional(),logging:he.optional(),completions:he.optional(),prompts:k({listChanged:Y().optional()}).optional(),resources:k({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:k({listChanged:Y().optional()}).optional(),tasks:Qv.optional(),extensions:ee(g(),he).optional()}),qc=xe.extend({protocolVersion:g(),capabilities:r$,serverInfo:Gg,instructions:g().optional()}),ei=Ke.extend({method:R("notifications/initialized"),params:He.optional()}),Xg=e=>ei.safeParse(e).success,ti=we.extend({method:R("ping"),params:Be.optional()}),n$=k({progress:K(),total:ae(K()),message:ae(g())}),o$=k({...He.shape,...n$.shape,progressToken:Fg}),ri=Ke.extend({method:R("notifications/progress"),params:o$}),s$=Be.extend({cursor:Bg.optional()}),Jn=we.extend({params:s$.optional()}),Wn=xe.extend({nextCursor:Bg.optional()}),i$=je(["working","input_required","completed","failed","cancelled"]),Gn=k({taskId:g(),status:i$,ttl:re([K(),Tg()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ae(K()),statusMessage:ae(g())}),kt=xe.extend({task:Gn}),a$=He.merge(Gn),Xn=Ke.extend({method:R("notifications/tasks/status"),params:a$}),ni=we.extend({method:R("tasks/get"),params:Be.extend({taskId:g()})}),oi=xe.merge(Gn),si=we.extend({method:R("tasks/result"),params:Be.extend({taskId:g()})}),WC=xe.loose(),ii=Jn.extend({method:R("tasks/list")}),ai=Wn.extend({tasks:z(Gn)}),ci=we.extend({method:R("tasks/cancel"),params:Be.extend({taskId:g()})}),Yg=xe.merge(Gn),Qg=k({uri:g(),mimeType:ae(g()),_meta:ee(g(),ie()).optional()}),ey=Qg.extend({text:g()}),Fc=g().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ty=Qg.extend({blob:Fc}),Yn=je(["user","assistant"]),Xr=k({audience:z(Yn).optional(),priority:K().min(0).max(1).optional(),lastModified:Ks.datetime({offset:!0}).optional()}),ry=k({...Wr.shape,...Kn.shape,uri:g(),description:ae(g()),mimeType:ae(g()),size:ae(K()),annotations:Xr.optional(),_meta:ae(pe({}))}),c$=k({...Wr.shape,...Kn.shape,uriTemplate:g(),description:ae(g()),mimeType:ae(g()),annotations:Xr.optional(),_meta:ae(pe({}))}),u$=Jn.extend({method:R("resources/list")}),Bc=Wn.extend({resources:z(ry)}),l$=Jn.extend({method:R("resources/templates/list")}),Vc=Wn.extend({resourceTemplates:z(c$)}),Hc=Be.extend({uri:g()}),d$=Hc,f$=we.extend({method:R("resources/read"),params:d$}),Kc=xe.extend({contents:z(re([ey,ty]))}),Jc=Ke.extend({method:R("notifications/resources/list_changed"),params:He.optional()}),p$=Hc,h$=we.extend({method:R("resources/subscribe"),params:p$}),m$=Hc,g$=we.extend({method:R("resources/unsubscribe"),params:m$}),y$=He.extend({uri:g()}),_$=Ke.extend({method:R("notifications/resources/updated"),params:y$}),b$=k({name:g(),description:ae(g()),required:ae(Y())}),w$=k({...Wr.shape,...Kn.shape,description:ae(g()),arguments:ae(z(b$)),_meta:ae(pe({}))}),x$=Jn.extend({method:R("prompts/list")}),Wc=Wn.extend({prompts:z(w$)}),v$=Be.extend({name:g(),arguments:ee(g(),g()).optional()}),$$=we.extend({method:R("prompts/get"),params:v$}),Gc=k({type:R("text"),text:g(),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),Xc=k({type:R("image"),data:Fc,mimeType:g(),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),Yc=k({type:R("audio"),data:Fc,mimeType:g(),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),S$=k({type:R("tool_use"),name:g(),id:g(),input:ee(g(),ie()),_meta:ee(g(),ie()).optional()}),z$=k({type:R("resource"),resource:re([ey,ty]),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),k$=ry.extend({type:R("resource_link")}),Qc=re([Gc,Xc,Yc,k$,z$]),P$=k({role:Yn,content:Qc}),eu=xe.extend({description:g().optional(),messages:z(P$)}),tu=Ke.extend({method:R("notifications/prompts/list_changed"),params:He.optional()}),E$=k({title:g().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),T$=k({taskSupport:je(["required","optional","forbidden"]).optional()}),ny=k({...Wr.shape,...Kn.shape,description:g().optional(),inputSchema:k({type:R("object"),properties:ee(g(),he).optional(),required:z(g()).optional()}).catchall(ie()),outputSchema:k({type:R("object"),properties:ee(g(),he).optional(),required:z(g()).optional()}).catchall(ie()).optional(),annotations:E$.optional(),execution:T$.optional(),_meta:ee(g(),ie()).optional()}),ru=Jn.extend({method:R("tools/list")}),nu=Wn.extend({tools:z(ny)}),Ft=xe.extend({content:z(Qc).default([]),structuredContent:ee(g(),ie()).optional(),isError:Y().optional()}),GC=Ft.or(xe.extend({toolResult:ie()})),O$=Vn.extend({name:g(),arguments:ee(g(),ie()).optional()}),Qn=we.extend({method:R("tools/call"),params:O$}),ou=Ke.extend({method:R("notifications/tools/list_changed"),params:He.optional()}),oy=k({autoRefresh:Y().default(!0),debounceMs:K().int().nonnegative().default(300)}),eo=je(["debug","info","notice","warning","error","critical","alert","emergency"]),R$=Be.extend({level:eo}),su=we.extend({method:R("logging/setLevel"),params:R$}),A$=He.extend({level:eo,logger:g().optional(),data:ie()}),C$=Ke.extend({method:R("notifications/message"),params:A$}),I$=k({name:g().optional()}),N$=k({hints:z(I$).optional(),costPriority:K().min(0).max(1).optional(),speedPriority:K().min(0).max(1).optional(),intelligencePriority:K().min(0).max(1).optional()}),j$=k({mode:je(["auto","required","none"]).optional()}),Z$=k({type:R("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:z(Qc).default([]),structuredContent:k({}).loose().optional(),isError:Y().optional(),_meta:ee(g(),ie()).optional()}),D$=Nc("type",[Gc,Xc,Yc]),Ws=Nc("type",[Gc,Xc,Yc,S$,Z$]),M$=k({role:Yn,content:re([Ws,z(Ws)]),_meta:ee(g(),ie()).optional()}),L$=Vn.extend({messages:z(M$),modelPreferences:N$.optional(),systemPrompt:g().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:K().optional(),maxTokens:K().int(),stopSequences:z(g()).optional(),metadata:he.optional(),tools:z(ny).optional(),toolChoice:j$.optional()}),iu=we.extend({method:R("sampling/createMessage"),params:L$}),ur=xe.extend({model:g(),stopReason:ae(je(["endTurn","stopSequence","maxTokens"]).or(g())),role:Yn,content:D$}),to=xe.extend({model:g(),stopReason:ae(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Yn,content:re([Ws,z(Ws)])}),U$=k({type:R("boolean"),title:g().optional(),description:g().optional(),default:Y().optional()}),q$=k({type:R("string"),title:g().optional(),description:g().optional(),minLength:K().optional(),maxLength:K().optional(),format:je(["email","uri","date","date-time"]).optional(),default:g().optional()}),F$=k({type:je(["number","integer"]),title:g().optional(),description:g().optional(),minimum:K().optional(),maximum:K().optional(),default:K().optional()}),B$=k({type:R("string"),title:g().optional(),description:g().optional(),enum:z(g()),default:g().optional()}),V$=k({type:R("string"),title:g().optional(),description:g().optional(),oneOf:z(k({const:g(),title:g()})),default:g().optional()}),H$=k({type:R("string"),title:g().optional(),description:g().optional(),enum:z(g()),enumNames:z(g()).optional(),default:g().optional()}),K$=re([B$,V$]),J$=k({type:R("array"),title:g().optional(),description:g().optional(),minItems:K().optional(),maxItems:K().optional(),items:k({type:R("string"),enum:z(g())}),default:z(g()).optional()}),W$=k({type:R("array"),title:g().optional(),description:g().optional(),minItems:K().optional(),maxItems:K().optional(),items:k({anyOf:z(k({const:g(),title:g()}))}),default:z(g()).optional()}),G$=re([J$,W$]),X$=re([H$,K$,G$]),Y$=re([X$,U$,q$,F$]),Q$=Vn.extend({mode:R("form").optional(),message:g(),requestedSchema:k({type:R("object"),properties:ee(g(),Y$),required:z(g()).optional()})}),eS=Vn.extend({mode:R("url"),message:g(),elicitationId:g(),url:g().url()}),tS=re([Q$,eS]),au=we.extend({method:R("elicitation/create"),params:tS}),rS=He.extend({elicitationId:g()}),nS=Ke.extend({method:R("notifications/elicitation/complete"),params:rS}),Bt=xe.extend({action:je(["accept","decline","cancel"]),content:jc(e=>e===null?void 0:e,ee(g(),re([g(),K(),Y(),z(g())])).optional())}),oS=k({type:R("ref/resource"),uri:g()});var sS=k({type:R("ref/prompt"),name:g()}),iS=Be.extend({ref:re([sS,oS]),argument:k({name:g(),value:g()}),context:k({arguments:ee(g(),g()).optional()}).optional()}),aS=we.extend({method:R("completion/complete"),params:iS});var cu=xe.extend({completion:pe({values:z(g()).max(100),total:ae(K().int()),hasMore:ae(Y())})}),cS=k({uri:g().startsWith("file://"),name:g().optional(),_meta:ee(g(),ie()).optional()}),uS=we.extend({method:R("roots/list"),params:Be.optional()}),uu=xe.extend({roots:z(cS)}),lS=Ke.extend({method:R("notifications/roots/list_changed"),params:He.optional()}),XC=re([ti,Uc,aS,su,$$,x$,u$,l$,f$,h$,g$,Qn,ru,ni,si,ii,ci]),YC=re([Qs,ri,ei,lS,Xn]),QC=re([zt,ur,to,Bt,uu,oi,ai,kt]),eI=re([ti,iu,au,uS,ni,si,ii,ci]),tI=re([Qs,ri,C$,_$,Jc,ou,tu,Xn,nS]),rI=re([zt,qc,cu,eu,Wc,Bc,Vc,Kc,Ft,nu,oi,ai,kt]),A=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===N.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Zc(o.elicitations,r)}return new e(t,r,n)}},Zc=class extends A{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(N.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Vt(e){return e==="completed"||e==="failed"||e==="cancelled"}var NI=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function lu(e){let r=Kr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Jr(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function du(e,t){let r=Re(e,t);if(!r.success)throw r.error;return r.data}var gS=6e4,Yr=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(Qs,r=>{this._oncancel(r)}),this.setNotificationHandler(ri,r=>{this._onprogress(r)}),this.setRequestHandler(ti,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ni,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new A(N.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(si,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new A(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new A(N.InvalidParams,`Task not found: ${s}`);if(!Vt(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(Vt(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[qt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(ii,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new A(N.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ci,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new A(N.InvalidParams,`Task not found: ${r.params.taskId}`);if(Vt(o.status))throw new A(N.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new A(N.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof A?o:new A(N.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),A.fromError(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});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 n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),cr(s)||Wg(s)?this._onresponse(s):Hn(s)?this._onrequest(s,i):Jg(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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=A.fromError(N.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(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(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[qt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:N.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=Vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new A(N.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:N.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),cr(t))n(t);else{let i=new A(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===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(cr(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),cr(t))o(t);else{let i=A.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(i){yield{type:"error",error:i instanceof A?i:new A(N.InternalError,String(i))}}return}let s;try{let i=await this.request(t,kt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new A(N.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Vt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new A(N.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new A(N.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof A?i:new A(N.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=v=>{l(v)};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(v){d(v);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[qt]:c}});let h=v=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(v)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let S=v instanceof A?v:new A(N.RequestTimeout,String(v));l(S)};this._responseHandlers.set(p,v=>{if(!n?.signal?.aborted){if(v instanceof Error)return l(v);try{let S=Re(r,v.result);S.success?u(S.data):l(S.error)}catch(S){l(S)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let m=n?.timeout??gS,y=()=>h(A.fromError(N.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let v=S=>{let T=this._responseHandlers.get(p);T?T(S):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(p),l(S)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(v=>{this._cleanupTimeout(p),l(v)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},oi,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},ai,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Yg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[qt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{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||{},[qt]: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||{},[qt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=lu(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=du(t,o);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 n=lu(t);this._notificationHandlers.set(n,o=>{let s=du(t,o);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,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Hn(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new A(N.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){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new A(N.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new A(N.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new A(N.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Xn.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Vt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new A(N.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Vt(a.status))throw new A(N.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Xn.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Vt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function sy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ui(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];sy(i)&&sy(s)?r[o]={...i,...s}:r[o]=s}return r}var ob=ca(nd(),1),sb=ca(nb(),1);function PT(){let e=new ob.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,sb.default)(e),e}var yn=class{constructor(t){this._ajv=t??PT()}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 n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Hi=class{constructor(t){this._client=t}async*callToolStream(t,r=Ft,n){let o=this._client,s={...n,task:n?.task??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},r,s),a=o.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new A(N.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=a(u.structuredContent);if(!l.valid){yield{type:"error",error:new A(N.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof A){yield{type:"error",error:l};return}yield{type:"error",error:new A(N.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._client.getTaskResult({taskId:t},r,n)}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,n){return this._client.requestStream(t,r,n)}};function Ki(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 Ji(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 Wi(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[o]=s.default),r[o]!==void 0&&Wi(s,r[o])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&Wi(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&Wi(r,t)}}function ET(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 Gi=class extends Yr{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 yn,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",ou,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",tu,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Jc,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Hi(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ui(this._capabilities,t)}setRequestHandler(t,r){let o=Kr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Jr(o);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,u)=>{let l=Re(au,c);if(!l.success){let v=l.error instanceof Error?l.error.message:String(l.error);throw new A(N.InvalidParams,`Invalid elicitation request: ${v}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=ET(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new A(N.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new A(N.InvalidParams,"Client does not support URL-mode elicitation requests");let h=await Promise.resolve(r(c,u));if(d.task){let v=Re(kt,h);if(!v.success){let S=v.error instanceof Error?v.error.message:String(v.error);throw new A(N.InvalidParams,`Invalid task creation result: ${S}`)}return v.data}let m=Re(Bt,h);if(!m.success){let v=m.error instanceof Error?m.error.message:String(m.error);throw new A(N.InvalidParams,`Invalid elicitation result: ${v}`)}let y=m.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{Wi(w,y.content)}catch{}return y};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=Re(iu,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new A(N.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let y=Re(kt,p);if(!y.success){let w=y.error instanceof Error?y.error.message:String(y.error);throw new A(N.InvalidParams,`Invalid task creation result: ${w}`)}return y.data}let h=d.tools||d.toolChoice?to:ur,m=Re(h,p);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new A(N.InvalidParams,`Invalid sampling result: ${y}`)}return m.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 n=await this.request({method:"initialize",params:{protocolVersion:Ut,capabilities:this._capabilities,clientInfo:this._clientInfo}},qc,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Gs.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}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){Ki(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&Ji(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},zt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},cu,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},zt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},eu,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Wc,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Bc,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Vc,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Kc,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},zt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},zt,r)}async callTool(t,r=Ft,n){if(this.isToolTaskRequired(t.name))throw new A(N.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:t},r,n),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new A(N.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new A(N.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof A?i:new A(N.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}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 o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let n=await this.request({method:"tools/list",params:t},nu,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,o){let s=oy.safeParse(n);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let p=setTimeout(u,a);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var lb=ca(ub(),1);function db(e){if(e)try{return lb.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function Xi(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function fb(e=fetch,t){return t?async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Xi(t.headers),...Xi(n.headers)}:t.headers};return e(r,o)}:e}var fd;fd=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function ZT(e){return(await fd).getRandomValues(new Uint8Array(e))}async function DT(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,n="";for(;n.length<e;){let o=await ZT(e-n.length);for(let s of o)s<r&&(n+=t[s%t.length])}return n}async function MT(e){return await DT(e)}async function LT(e){let t=await(await fd).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function pd(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await MT(e),r=await LT(t);return{code_verifier:t,code_challenge:r}}var ze=Pg().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:qg.custom,message:"URL must be parseable",fatal:!0}),qa}).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"}),hb=pe({resource:g().url(),authorization_servers:z(ze).optional(),jwks_uri:g().url().optional(),scopes_supported:z(g()).optional(),bearer_methods_supported:z(g()).optional(),resource_signing_alg_values_supported:z(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:Y().optional(),authorization_details_types_supported:z(g()).optional(),dpop_signing_alg_values_supported:z(g()).optional(),dpop_bound_access_tokens_required:Y().optional()}),hd=pe({issuer:g(),authorization_endpoint:ze,token_endpoint:ze,registration_endpoint:ze.optional(),scopes_supported:z(g()).optional(),response_types_supported:z(g()),response_modes_supported:z(g()).optional(),grant_types_supported:z(g()).optional(),token_endpoint_auth_methods_supported:z(g()).optional(),token_endpoint_auth_signing_alg_values_supported:z(g()).optional(),service_documentation:ze.optional(),revocation_endpoint:ze.optional(),revocation_endpoint_auth_methods_supported:z(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:z(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(g()).optional(),code_challenge_methods_supported:z(g()).optional(),client_id_metadata_document_supported:Y().optional()}),UT=pe({issuer:g(),authorization_endpoint:ze,token_endpoint:ze,userinfo_endpoint:ze.optional(),jwks_uri:ze,registration_endpoint:ze.optional(),scopes_supported:z(g()).optional(),response_types_supported:z(g()),response_modes_supported:z(g()).optional(),grant_types_supported:z(g()).optional(),acr_values_supported:z(g()).optional(),subject_types_supported:z(g()),id_token_signing_alg_values_supported:z(g()),id_token_encryption_alg_values_supported:z(g()).optional(),id_token_encryption_enc_values_supported:z(g()).optional(),userinfo_signing_alg_values_supported:z(g()).optional(),userinfo_encryption_alg_values_supported:z(g()).optional(),userinfo_encryption_enc_values_supported:z(g()).optional(),request_object_signing_alg_values_supported:z(g()).optional(),request_object_encryption_alg_values_supported:z(g()).optional(),request_object_encryption_enc_values_supported:z(g()).optional(),token_endpoint_auth_methods_supported:z(g()).optional(),token_endpoint_auth_signing_alg_values_supported:z(g()).optional(),display_values_supported:z(g()).optional(),claim_types_supported:z(g()).optional(),claims_supported:z(g()).optional(),service_documentation:g().optional(),claims_locales_supported:z(g()).optional(),ui_locales_supported:z(g()).optional(),claims_parameter_supported:Y().optional(),request_parameter_supported:Y().optional(),request_uri_parameter_supported:Y().optional(),require_request_uri_registration:Y().optional(),op_policy_uri:ze.optional(),op_tos_uri:ze.optional(),client_id_metadata_document_supported:Y().optional()}),mb=k({...UT.shape,...hd.pick({code_challenge_methods_supported:!0}).shape}),gb=k({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:Js.number().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),yb=k({error:g(),error_description:g().optional(),error_uri:g().optional()}),pb=ze.optional().or(R("").transform(()=>{})),qT=k({redirect_uris:z(ze),token_endpoint_auth_method:g().optional(),grant_types:z(g()).optional(),response_types:z(g()).optional(),client_name:g().optional(),client_uri:ze.optional(),logo_uri:pb,scope:g().optional(),contacts:z(g()).optional(),tos_uri:pb,policy_uri:g().optional(),jwks_uri:ze.optional(),jwks:Og().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),FT=k({client_id:g(),client_secret:g().optional(),client_id_issued_at:K().optional(),client_secret_expires_at:K().optional(),issuer:g().optional().catch(void 0)}).strip(),_b=qT.merge(FT),lZ=k({error:g(),error_description:g().optional()}).strip(),dZ=k({token:g(),token_type_hint:g().optional()}).strip();function bb(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function wb({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var fe=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}},Io=class extends fe{};Io.errorCode="invalid_request";var vr=class extends fe{};vr.errorCode="invalid_client";var $r=class extends fe{};$r.errorCode="invalid_grant";var Sr=class extends fe{};Sr.errorCode="unauthorized_client";var No=class extends fe{};No.errorCode="unsupported_grant_type";var jo=class extends fe{};jo.errorCode="invalid_scope";var Zo=class extends fe{};Zo.errorCode="access_denied";var At=class extends fe{};At.errorCode="server_error";var Do=class extends fe{};Do.errorCode="temporarily_unavailable";var Mo=class extends fe{};Mo.errorCode="unsupported_response_type";var Lo=class extends fe{};Lo.errorCode="unsupported_token_type";var Uo=class extends fe{};Uo.errorCode="invalid_token";var qo=class extends fe{};qo.errorCode="method_not_allowed";var Fo=class extends fe{};Fo.errorCode="too_many_requests";var zr=class extends fe{};zr.errorCode="invalid_client_metadata";var Bo=class extends fe{};Bo.errorCode="insufficient_scope";var Vo=class extends fe{};Vo.errorCode="invalid_target";var xb={[Io.errorCode]:Io,[vr.errorCode]:vr,[$r.errorCode]:$r,[Sr.errorCode]:Sr,[No.errorCode]:No,[jo.errorCode]:jo,[Zo.errorCode]:Zo,[At.errorCode]:At,[Do.errorCode]:Do,[Mo.errorCode]:Mo,[Lo.errorCode]:Lo,[Uo.errorCode]:Uo,[qo.errorCode]:qo,[Fo.errorCode]:Fo,[zr.errorCode]:zr,[Bo.errorCode]:Bo,[Vo.errorCode]:Vo};var Ct=class extends Error{constructor(t){super(t??"Unauthorized")}};function BT(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var md="code",gd="S256";function VT(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&BT(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 HT(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":KT(o,s,r);return;case"client_secret_post":JT(o,s,n);return;case"none":WT(o,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function KT(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function JT(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function WT(e,t){t.set("client_id",e)}async function $b(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=yb.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=xb[o]||At;return new a(s||"",i)}catch(n){let o=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new At(o)}}function GT(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function bd(e,t){if(e)return typeof e.issuer!="string"?e.issuer==null?e:{...e,issuer:void 0}:GT(e.issuer,t)?e:void 0}var XT=gb.omit({issuer:!0}),YT=_b.omit({issuer:!0});function Sb(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 Ho(e,t){try{return await yd(e,t)}catch(r){if(r instanceof vr||r instanceof Sr)return await e.invalidateCredentials?.("all"),await yd(e,t);if(r instanceof $r)return await e.invalidateCredentials?.("tokens"),await yd(e,t);throw r}}async function yd(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=o;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await kb(c,{fetchFn:s}),!a)try{a=await zb(t,{resourceMetadataUrl:l},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}else{let O=await sO(t,{resourceMetadataUrl:l,fetchFn:s});c=O.authorizationServerUrl,u=O.authorizationServerMetadata,a=O.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=String(c),p=await eO(t,e,a),f=p&&a&&!e.validateResourceURL?a.resource:p,h=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation()),y=bd(m,d),w=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(m&&!y&&!w)throw Sb(m,d);let v=y?.issuer==null?y:void 0,S=async()=>{try{v&&await e.saveClientInformation?.({...v,issuer:d})}catch{}};if(!y){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let O=u?.client_id_metadata_document_supported===!0,D=e.clientMetadataUrl;if(D&&!QT(D))throw new zr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${D}`);if(O&&D)y={client_id:D,issuer:d},await e.saveClientInformation?.(y);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");y={...await lO(c,{metadata:u,clientMetadata:e.clientMetadata,scope:h,fetchFn:s}),issuer:d},await e.saveClientInformation(y)}}let T=!e.redirectUrl;if(r!==void 0||T){let O=await uO(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:s});return await S(),await e.saveTokens({...O,issuer:d}),"AUTHORIZED"}let _=bd(await e.tokens(),d);if(_?.refresh_token&&_.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."),_?.refresh_token)try{let O=await cO(c,{metadata:u,clientInformation:y,refreshToken:_.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await S(),await e.saveTokens({...O,issuer:d}),"AUTHORIZED"}catch(O){if(!(!(O instanceof fe)||O instanceof At))throw O}let x=e.state?await e.state():void 0,{authorizationUrl:$,codeVerifier:P}=await iO(c,{metadata:u,clientInformation:y,state:x,redirectUrl:e.redirectUrl,scope:h,resource:f});return await e.saveCodeVerifier(P),await e.redirectToAuthorization($),"REDIRECT"}function QT(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function eO(e,t,r){let n=bb(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(r){if(!wb({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function wd(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=_d(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=_d(e,"scope")||void 0,a=_d(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function _d(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function zb(e,t,r=fetch){let n=await nO(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return hb.parse(await n.json())}async function xd(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?xd(e,void 0,r):void 0;throw n}}function tO(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function vb(e,t,r=fetch){return await xd(e,{"MCP-Protocol-Version":t},r)}function rO(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function nO(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Ut,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=tO(t,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await vb(i,s,r);if(!n?.metadataUrl&&rO(a,o.pathname)){let c=new URL(`/.well-known/${t}`,o);a=await vb(c,s,r)}return a}function oO(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function kb(e,{fetchFn:t=fetch,protocolVersion:r=Ut}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=oO(e);for(let{url:s,type:i}of o){let a=await xd(s,n,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?hd.parse(await a.json()):mb.parse(await a.json())}}}async function sO(e,t){let r,n;try{r=await zb(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));let o=await kb(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function Pb(e){return typeof e=="string"?e:e.href}async function iO(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(md))throw new Error(`Incompatible auth server: does not support response type ${md}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(gd))throw new Error(`Incompatible auth server: does not support code challenge method ${gd}`)}else a=new URL("/authorize",e);let c=await pd(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",md),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",gd),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",Pb(i)),{authorizationUrl:a,codeVerifier:u}}function aO(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Eb(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,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",Pb(s)),o)await o(c,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=VT(n,l);HT(d,n,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await $b(u);return XT.parse(await u.json())}async function cO(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await Eb(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function uO(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=bd(l,String(t));if(l&&!d)throw Sb(l,String(t));return d},a=await i(),c=e.clientMetadata.scope,u;if(e.prepareTokenRequest&&(u=await e.prepareTokenRequest(c)),!u){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();u=aO(o,l,e.redirectUrl)}return a??(a=await i()),Eb(t,{metadata:r,tokenRequestParams:u,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function lO(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){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(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await $b(i);return YT.parse(await i.json())}var Ko=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}},Tb=10,dO=13,kr=32;function vd(e){}function Ab(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=vd,onError:r=vd,onRetry:n=vd,onComment:o,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l="",d=0,p,f=!1;function h(_){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,_.charCodeAt(0)===239&&_.charCodeAt(1)===187&&_.charCodeAt(2)===191&&(_=_.slice(3))),i.length===0){let P=y(_);P!==""&&(i.push(P),a=P.length),m();return}if(_.indexOf(`
|
|
70
|
-
`)===-1&&
|
|
71
|
-
`,x);for(
|
|
72
|
-
`,x);continue}let
|
|
73
|
-
`,x);continue}l=d===0?
|
|
74
|
-
${
|
|
75
|
-
`,x)}return
|
|
76
|
-
`,x),
|
|
77
|
-
${
|
|
78
|
-
${x}`,d++;break;case"id":x.includes("\0")||(u=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Ko(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:$}));break;default:r(new Ko(`Unknown field "${_.length>20?`${_.slice(0,20)}\u2026`:_}"`,{type:"unknown-field",field:_,value:x,line:$}));break}}function S(){d>0&&t({id:u,event:p,data:l}),u=void 0,l="",d=0,p=void 0}function T(_={}){if(_.consume&&i.length>0){let x=i.join("");w(x,0,x.length)}c=!0,u=void 0,l="",d=0,p=void 0,i.length=0,a=0,f=!1}return{feed:h,reset:T}}function Ob(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 Rb(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 Yi=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=Ab({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:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var fO={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},er=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Qi=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=fb(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??fO}async _authThenStart(){if(!this._authProvider)throw new Ct("No auth provider");let t;try{t=await Ho(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 n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=Xi(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new er(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,t,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),o)}_scheduleReconnection(t,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=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)})},o)}_handleSseStream(t,r,n){if(!t)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new Yi({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:h}=await l.read();if(h)break;if(f.id&&(i=f.id,a=!0,o?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let m=Gr.parse(JSON.parse(f.data));cr(m)&&(c=!0,s!==void 0&&(m.id=s)),this.onmessage?.(m)}catch(m){this.onerror?.(m)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,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 Ho(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:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Hn(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(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 er(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:h,scope:m}=wd(a);if(this._resourceMetadataUrl=h,this._scope=m,await Ho(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:h,scope:m,error:y}=wd(a);if(y==="insufficient_scope"){let w=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===w)throw new er(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),h&&(this._resourceMetadataUrl=h),this._lastUpscopingHeader=w??void 0,await Ho(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ct;return this.send(t)}}throw new er(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Xg(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let l=(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"),p=db(d);if(l)if(p==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(p==="application/json"){let f=await a.json(),h=Array.isArray(f)?f.map(m=>Gr.parse(m)):[Gr.parse(f)];for(let m of h)this.onmessage?.(m)}else throw await a.body?.cancel(),new er(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}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},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new er(n.status,`Failed to terminate session: ${n.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})}};var ea=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},ur,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Bt,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};var ta=class extends Yr{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(eo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new yn,this.setRequestHandler(Uc,n=>this._oninitialize(n)),this.setNotificationHandler(ei,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(su,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=eo.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ea(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ui(this._capabilities,t)}setRequestHandler(t,r){let o=Kr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Jr(o);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Re(Qn,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new A(N.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=Re(kt,p);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new A(N.InvalidParams,`Invalid task creation result: ${m}`)}return h.data}let f=Re(Ft,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new A(N.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Ji(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Ki(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Gs.includes(r)?r:Ut,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},zt)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},to,r):this.request({method:"sampling/createMessage",params:t},ur,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Bt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Bt,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new A(N.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof A?i:new A(N.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},uu,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import Ib from"node:process";var pO=10*1024*1024,ra=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??pO}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(`
|
|
79
|
-
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),
|
|
80
|
-
`}var
|
|
81
|
-
`);function
|
|
69
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=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(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Pm(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Pm(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.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 Em=new Set(["type","properties","required","additionalProperties"]),zm=["oneOf","anyOf"];function km(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function zc(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!Em.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??km(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:zc(a)??{allOf:a};Ve(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=km(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function Cx(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Em)if(o in e)return;let r=t.filter(o=>zm.some(s=>Array.isArray(o[s]))),n=null;if(!r.length)n=zc(t);else{let o=r[0],s=zm.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter(c=>c!==o),a=o[s].map(c=>zc([...i,c]));if(a.some(c=>!c))return;n={[s]:a}}n&&(delete e.allOf,Un(e,n))}function Ec(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Un(u,h),Un(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(h.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==d){n(p);let f=e.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let h in u)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Pm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Cx(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Un(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Ve(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:qn(t,"input",e.processors),output:qn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ce(n.element,r);if(n.type==="set")return Ce(n.valueType,r);if(n.type==="lazy")return Ce(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Ce(n.innerType,r);if(n.type==="intersection")return Ce(n.left,r)||Ce(n.right,r);if(n.type==="record"||n.type==="map")return Ce(n.keyType,r)||Ce(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ce(n.in,r)||Ce(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ce(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ce(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ce(o,r))return!0;return!!(n.rest&&Ce(n.rest,r))}return!1}var Tm=(e,t={})=>r=>{let n=kc({...r,processors:t});return he(e,n),Pc(n,e),Ec(n,e)},qn=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=kc({...o??{},target:s,io:t,processors:r});return he(e,i),Pc(i,e),Ec(i,e)};var Hr=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Kr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Om=(e,t)=>{Hr(e,"minimum",t),Kr(e,"maximum",t)},Im=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Nm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},jm=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Zm=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Rm=(e,t)=>Hr(e,"minimum",t.minimum),Am=(e,t)=>Kr(e,"maximum",t.maximum),Cm=e=>(t,r)=>{Zm(t,r.format);let[n,o]=e[r.format];Hr(t,"minimum",n),Kr(t,"maximum",o)},Ix={greater_than:(e,t)=>Hr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Kr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Im(e,t.value),number_format:Cm(An),bigint_format:Cm(ms),min_length:Rm,max_length:Am,length_equals:(e,t)=>Om(e,t.length),min_size:Rm,max_size:Am,size_equals:(e,t)=>Om(e,t.size),string_format:(e,t)=>{Zm(e,t.format),t.pattern&&Nm(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)=>jm(e,t.mime)};function ve(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Ix[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Hr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Hr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Kr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Kr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Im(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&jm(t,o.mime);for(let s of o.patterns??[])Nm(t,s);return t}var Nx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jx=new Map([[nc,Wf],[Rs,Gf]]),Dm=e=>jx.get(e)??e,Mm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=ve(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Nx[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let d=[...c].map(Dm);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Lm=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=ve(e);o.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),p?f?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i=="number"&&(o.maximum=i),a){let h=new Set;for(let _ of a)Number.isFinite(_)&&_!==0?h.add(Math.abs(_)):it(e,t,o,n,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`);let[m,...y]=h;m!==void 0&&(o.multipleOf=m),y.length&&(o.allOf=[...o.allOf??[],...y.map(_=>({multipleOf:_}))])}},Um=(e,t,r,n)=>{r.type="boolean"},qm=(e,t,r,n)=>{it(e,t,r,n,"BigInt cannot be represented in JSON Schema")};var Fm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Bm=(e,t,r,n)=>{r.not={}},Vm=(e,t,r,n)=>{},Hm=(e,t,r,n)=>{},Km=(e,t,r,n)=>{it(e,t,r,n,"Date cannot be represented in JSON Schema")},Jm=(e,t,r,n)=>{let o=e._zod.def,s=jr(o.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},Wm=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(it(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(it(e,t,r,n,"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};var Gm=(e,t,r,n)=>{it(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Xm=(e,t,r,n)=>{it(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Ym=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=ve(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=he(s.element,t,{...n,path:[...n.path,"items"]})};function Fs(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Fs(t.out):t.type==="catch"?Fs(t.innerType):e._zod.optin}var Qm=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&it(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)Ve(o.properties,u,he(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?Fs(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=he(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},eg=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>he(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},tg=(e,t,r,n)=>{let o=e._zod.def,s=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=he(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function Tc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let m=Tc(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let y=m.map(_=>Tc(e,_,r));y.some((_,v)=>_!==m[v])&&(t={...t,[h]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(h=>typeof h=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:p,...f}=t;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?jn:Xa).source)),f}var Oc=new WeakMap;function Zx(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Oc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Tc(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);s&&(o.propertyNames=s)}}var rg=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=ve(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=he(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Ve(o.patternProperties,Dm(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=he(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Oc.get(t);l||(l=[],Oc.set(t,l),t.deferred.push(()=>Zx(t))),l.push(e)}o.additionalProperties=he(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Fs(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},ng=(e,t,r,n)=>{let o=e._zod.def,s=he(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},og=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Rc=Symbol();function sg(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(it(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Rc):JSON.parse(i)}var ig=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=sg(o.defaultValue,e,t,r,n);i!==Rc&&(r.default=i)},ag=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=sg(o.defaultValue,e,t,r,n);i!==Rc&&(r._prefault=i)},cg=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{it(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},ug=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;he(i,t,n);let a=t.seen.get(e);a.ref=i},lg=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Ac=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function Bs(e){return!!e._zod}function Ie(e,t){return Bs(e)?Ja(e,t):e.safeParse(t)}function Wr(e){if(!e)return;let t;if(Bs(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Gr(e){if(Bs(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 n=e.value;if(n!==void 0)return n}var dg=new WeakSet([Object.prototype,Error.prototype]);function Vs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Kx=(e,t)=>{$f.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);dg.has(r)||(dg.add(r),Vs(r,"format",n=>o=>Ka(n,o)),Vs(r,"flatten",n=>o=>Ha(n,o)),Vs(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Zr,2)}),Vs(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Zr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var He=b("ZodError",Kx,void 0,{Parent:Error});var fg=ws(He),pg=xs(He),hg=Nn(He),mg=vs(He),gg=kf(He),yg=Pf(He),_g=Ef(He),bg=Tf(He),wg=Of(He),xg=Rf(He),vg=Af(He),$g=Cf(He);function Wx(){Ze.localeError||De(Zh())}function Ks(){Ze.memoizer||De({memoizer:dc()})}var te=b("ZodType",(e,t)=>(Wx(),Q.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(j.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 We(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(jv(e,t))},superRefine(e,t){return this.check(Zv(e,t))},overwrite(e){return this.check(Ut(e))},optional(){return le(this)},exactOptional(){return Sv(this)},nullable(){return kg(this)},nullish(){return le(kg(this))},nonoptional(e){return Ov(this,e)},array(){return z(this)},or(e){return ie([this,e])},and(e){return Ws(this,e)},transform(e){return Pg(this,Zg(e))},default(e){return Pv(this,e)},prefault(e){return Tv(this,e)},catch(e){return Av(this,e)},pipe(e){return Pg(this,e)},readonly(){return Nv(this)},describe(e){let t=this.clone();return Lt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Lt.get(this);let t=this.clone();return Lt.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 j.hide(this,"~standard",{...rc(this),jsonSchema:{input:qn(this,"input"),output:qn(this,"output")}})},set"~standard"(e){j.own(this,"~standard",e)},parse:function e(t,r){return fg(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await pg(this,t,r,{callee:e})},safeParse(e,t){return hg(this,e,t)},async safeParseAsync(e,t){return mg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){j.own(this,"spa",e)},validate(e,t){return $s(this,e,t)},validateAsync(e,t){return Ss(this,e,t)},encode:function e(t,r){return gg(this,t,r,{callee:e})},decode:function e(t,r){return yg(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await _g(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await bg(this,t,r,{callee:e})},safeEncode(e,t){return wg(this,e,t)},safeDecode(e,t){return xg(this,e,t)},async safeEncodeAsync(e,t){return vg(this,e,t)},async safeDecodeAsync(e,t){return $g(this,e,t)},toJSONSchema(e){return Tm(this,{})(e)},get description(){return Lt.get(this)?.description},get _def(){return this._zod.def}}),Eg=b("_ZodString",(e,t)=>{Os.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mm(e,r,n,o)},j.derived({format:e=>ve(e).format??null,minLength:e=>ve(e).minimum??null,maxLength:e=>ve(e).maximum??null},{regex(...e){return this.check(hc(...e))},includes(...e){return this.check(yc(...e))},startsWith(...e){return this.check(_c(...e))},endsWith(...e){return this.check(bc(...e))},min(...e){return this.check(Vr(...e))},max(...e){return this.check(Us(...e))},length(...e){return this.check(qs(...e))},nonempty(...e){return this.check(Vr(1,...e))},lowercase(e){return this.check(mc(e))},uppercase(e){return this.check(gc(e))},trim(){return this.check(xc())},normalize(...e){return this.check(wc(...e))},toLowerCase(){return this.check(vc())},toUpperCase(){return this.check($c())},slugify(){return this.check(Sc())}})),Ic=b("ZodString",(e,t)=>{Os.init(e,t),Eg.init(e,t)},{email(e){return this.check(qh(Gx,e))},url(e){return this.check(pc(Tg,e))},jwt(e){return this.check(cm(fv,e))},emoji(e){return this.check(Jh(Yx,e))},guid(e){return this.check(Fh(Xx,e))},uuid(e){return this.check(Bh(Hs,e))},uuidv4(e){return this.check(Vh(Hs,e))},uuidv6(e){return this.check(Hh(Hs,e))},uuidv7(e){return this.check(Kh(Hs,e))},nanoid(e){return this.check(Wh(Qx,e))},cuid(e){return this.check(Gh(ev,e))},cuid2(e){return this.check(Xh(tv,e))},ulid(e){return this.check(Yh(rv,e))},base64(e){return this.check(sm(uv,e))},base64url(e){return this.check(im(lv,e))},xid(e){return this.check(Qh(nv,e))},ksuid(e){return this.check(em(ov,e))},ipv4(e){return this.check(tm(sv,e))},ipv6(e){return this.check(rm(iv,e))},cidrv4(e){return this.check(nm(av,e))},cidrv6(e){return this.check(om(cv,e))},e164(e){return this.check(am(dv,e))},datetime(e){return this.check(Zs(Fn,e))},date(e){return this.check(Ds(Bn,e))},time(e){return this.check(Ms(Vn,e))},duration(e){return this.check(Ls(Hn,e))}});function g(e){return Lh(Ic,e)}var de=b("ZodStringFormat",(e,t)=>{se.init(e,t),Eg.init(e,t)}),Fn=b("ZodISODateTime",(e,t)=>{Kp.init(e,t),de.init(e,t)}),Bn=b("ZodISODate",(e,t)=>{Jp.init(e,t),de.init(e,t)}),Vn=b("ZodISOTime",(e,t)=>{Wp.init(e,t),de.init(e,t)}),Hn=b("ZodISODuration",(e,t)=>{Gp.init(e,t),de.init(e,t)}),Gx=b("ZodEmail",(e,t)=>{jp.init(e,t),de.init(e,t)});var Xx=b("ZodGUID",(e,t)=>{Ip.init(e,t),de.init(e,t)});var Hs=b("ZodUUID",(e,t)=>{Np.init(e,t),de.init(e,t)});var Tg=b("ZodURL",(e,t)=>{Mp.init(e,t),de.init(e,t)});function Og(e){return pc(Tg,e)}var Yx=b("ZodEmoji",(e,t)=>{Lp.init(e,t),de.init(e,t)});var Qx=b("ZodNanoID",(e,t)=>{Up.init(e,t),de.init(e,t)});var ev=b("ZodCUID",(e,t)=>{qp.init(e,t),de.init(e,t)});var tv=b("ZodCUID2",(e,t)=>{Fp.init(e,t),de.init(e,t)});var rv=b("ZodULID",(e,t)=>{Bp.init(e,t),de.init(e,t)});var nv=b("ZodXID",(e,t)=>{Vp.init(e,t),de.init(e,t)});var ov=b("ZodKSUID",(e,t)=>{Hp.init(e,t),de.init(e,t)});var sv=b("ZodIPv4",(e,t)=>{Xp.init(e,t),de.init(e,t)});var iv=b("ZodIPv6",(e,t)=>{Qp.init(e,t),de.init(e,t)});var av=b("ZodCIDRv4",(e,t)=>{eh.init(e,t),de.init(e,t)});var cv=b("ZodCIDRv6",(e,t)=>{th.init(e,t),de.init(e,t)});var uv=b("ZodBase64",(e,t)=>{nh.init(e,t),de.init(e,t)});var lv=b("ZodBase64URL",(e,t)=>{oh.init(e,t),de.init(e,t)});var dv=b("ZodE164",(e,t)=>{sh.init(e,t),de.init(e,t)});var fv=b("ZodJWT",(e,t)=>{ih.init(e,t),de.init(e,t)});var Js=b("ZodNumber",(e,t)=>{oc.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o),e.isFinite=!0},j.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=ve(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=ve(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=ve(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>ve(e).format??null},{gt(e,t){return this.check(Br(e,t))},gte(e,t){return this.check(zt(e,t))},min(e,t){return this.check(zt(e,t))},lt(e,t){return this.check(Fr(e,t))},lte(e,t){return this.check(St(e,t))},max(e,t){return this.check(St(e,t))},int(e){return this.check(Sg(e))},safe(e){return this.check(Sg(e))},positive(e){return this.check(Br(0,e))},nonnegative(e){return this.check(zt(0,e))},negative(e){return this.check(Fr(0,e))},nonpositive(e){return this.check(St(0,e))},multipleOf(e,t){return this.check(Ln(e,t))},step(e,t){return this.check(Ln(e,t))},finite(){return this}}));function X(e){return um(Js,e)}var pv=b("ZodNumberFormat",(e,t)=>{ah.init(e,t),Js.init(e,t)});function Sg(e){return dm(pv,e)}var Nc=b("ZodBoolean",(e,t)=>{ch.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Um(e,r,n,o)});function re(e){return fm(Nc,e)}var Rg=b("ZodBigInt",(e,t)=>{uh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o)},j.derived({minValue:e=>ve(e).minimum??null,maxValue:e=>ve(e).maximum??null,format:e=>ve(e).format??null},{gte(e,t){return this.check(zt(e,t))},min(e,t){return this.check(zt(e,t))},gt(e,t){return this.check(Br(e,t))},lt(e,t){return this.check(Fr(e,t))},lte(e,t){return this.check(St(e,t))},max(e,t){return this.check(St(e,t))},positive(e){return this.check(Br(BigInt(0),e))},negative(e){return this.check(Fr(BigInt(0),e))},nonpositive(e){return this.check(St(BigInt(0),e))},nonnegative(e){return this.check(zt(BigInt(0),e))},multipleOf(e,t){return this.check(Ln(e,t))}}));var hv=b("ZodNull",(e,t)=>{lh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o)});function Ag(e){return mm(hv,e)}var mv=b("ZodAny",(e,t)=>{dh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vm(e,r,n,o)});function Cg(){return gm(mv)}var gv=b("ZodUnknown",(e,t)=>{fh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o)});function ue(){return ym(gv)}var yv=b("ZodNever",(e,t)=>{ph.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o)});function _v(e){return _m(yv,e)}var Ig=b("ZodDate",(e,t)=>{hh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o),e.min=(r,n)=>e.check(zt(r,n)),e.max=(r,n)=>e.check(St(r,n))},j.derived({minDate:e=>{let{minimum:t}=ve(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=ve(e);return t?new Date(t):null}},{}));var bv=b("ZodArray",(e,t)=>{Ks(),mh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Vr(e,t))},nonempty(e){return this.check(Vr(1,e))},max(e,t){return this.check(Us(e,t))},length(e,t){return this.check(qs(e,t))},unwrap(){return this.element}});function z(e,t){return wm(bv,e,t)}var Ng=b("ZodObject",(e,t)=>{Ks(),_h.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o),j.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Me(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(j.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(j.mergeDefs(this._zod.def,{catchall:ue()}))},loose(){return this.clone(j.mergeDefs(this._zod.def,{catchall:ue()}))},strict(){return this.clone(j.mergeDefs(this._zod.def,{catchall:_v()}))},strip(){return this.clone(j.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return j.extend(this,e)},safeExtend(e){return j.safeExtend(this,e)},merge(e){return j.merge(this,e)},pick(e){return j.pick(this,e)},omit(e){return j.omit(this,e)},partial(...e){return j.partial(Dg,this,e[0])},exactPartial(...e){return j.partial(Mg,this,e[0],"exactPartial")},required(...e){return j.required(Lg,this,e[0])}});function k(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new Ng(r)}function ye(e,t){return new Ng({type:"object",shape:e,catchall:ue(),...j.normalizeParams(t)})}var jg=b("ZodUnion",(e,t)=>{sc.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.options=t.options});function ie(e,t){return new jg({type:"union",options:e,...j.normalizeParams(t)})}var wv=b("ZodDiscriminatedUnion",(e,t)=>{jg.init(e,t),bh.init(e,t)});function jc(e,t,r){return new wv({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var xv=b("ZodIntersection",(e,t)=>{wh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o)});function Ws(e,t){return new xv({type:"intersection",left:e,right:t})}var zg=b("ZodRecord",(e,t)=>{Ks(),xh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rg(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function oe(e,t,r){return!t||!t._zod?new zg({type:"record",keyType:g(),valueType:e,...j.normalizeParams(t)}):new zg({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var Cc=b("ZodEnum",(e,t)=>{vh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Jm(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Cc({...t,checks:[],...j.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Cc({...t,checks:[],...j.normalizeParams(o),entries:s})}});function Me(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Cc({type:"enum",entries:r,...j.normalizeParams(t)})}var vv=b("ZodLiteral",(e,t)=>{$h.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o),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 O(e,t){return new vv({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var $v=b("ZodTransform",(e,t)=>{Ks(),Sh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ur(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(j.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(j.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Zg(e){return new $v({type:"transform",transform:e})}var Dg=b("ZodOptional",(e,t)=>{ic.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ac(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function le(e){return new Dg({type:"optional",innerType:e})}var Mg=b("ZodExactOptional",(e,t)=>{zh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ac(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sv(e){return new Mg({type:"optional",innerType:e})}var zv=b("ZodNullable",(e,t)=>{kh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ng(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kg(e){return new zv({type:"nullable",innerType:e})}var kv=b("ZodDefault",(e,t)=>{Ph.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ig(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pv(e,t){return new kv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Ev=b("ZodPrefault",(e,t)=>{Eh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ag(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Tv(e,t){return new Ev({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Lg=b("ZodNonOptional",(e,t)=>{Th.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>og(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ov(e,t){return new Lg({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var Rv=b("ZodCatch",(e,t)=>{Oh.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Av(e,t){return new Rv({type:"catch",innerType:e,catchValue:typeof t=="function"?t:j.constantCatch(t)})}var Ug=b("ZodPipe",(e,t)=>{ac.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ug(e,r,n,o),e.in=t.in,e.out=t.out});function Pg(e,t){return new Ug({type:"pipe",in:e,out:t})}var Cv=b("ZodPreprocess",(e,t)=>{Ug.init(e,t),Rh.init(e,t)}),Iv=b("ZodReadonly",(e,t)=>{Ah.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nv(e){return new Iv({type:"readonly",innerType:e})}var qg=b("ZodCustom",(e,t)=>{Ch.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o)});function Fg(e,t){return xm(qg,e??(()=>!0),t)}function jv(e,t={}){return vm(qg,e,t)}function Zv(e,t){return $m(e,t)}function Zc(e,t){return new Cv({type:"pipe",in:Zg(e),out:t})}var Vg={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 Bg;Bg||(Bg={});var Gs={};ua(Gs,{ZodISODate:()=>Bn,ZodISODateTime:()=>Fn,ZodISODuration:()=>Hn,ZodISOTime:()=>Vn,date:()=>Lv,datetime:()=>Mv,duration:()=>qv,time:()=>Uv});function Mv(e){return Zs(Fn,e)}function Lv(e){return Ds(Bn,e)}function Uv(e){return Ms(Vn,e)}function qv(e){return Ls(Hn,e)}var Xs={};ua(Xs,{bigint:()=>Hv,boolean:()=>Vv,date:()=>Kv,number:()=>Bv,string:()=>Fv});function Fv(e){return Uh(Ic,e)}function Bv(e){return lm(Js,e)}function Vv(e){return pm(Nc,e)}function Hv(e){return hm(Rg,e)}function Kv(e){return bm(Ig,e)}var qt="2025-11-25";var Qs=[qt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ft="io.modelcontextprotocol/related-task",ei="2.0",_e=Fg(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Hg=ie([g(),X().int()]),Kg=g(),GC=ye({ttl:X().optional(),pollInterval:X().optional()}),Wv=k({ttl:X().optional()}),Gv=k({taskId:g()}),Mc=ye({progressToken:Hg.optional(),[Ft]:Gv.optional()}),Ke=k({_meta:Mc.optional()}),Kn=Ke.extend({task:Wv.optional()}),Jg=e=>Kn.safeParse(e).success,$e=k({method:g(),params:Ke.loose().optional()}),Ge=k({_meta:Mc.optional()}),Xe=k({method:g(),params:Ge.loose().optional()}),Se=ye({_meta:Mc.optional()}),ti=ie([g(),X().int()]),Wg=k({jsonrpc:O(ei),id:ti,...$e.shape}).strict(),Jn=e=>Wg.safeParse(e).success,Gg=k({jsonrpc:O(ei),...Xe.shape}).strict(),Xg=e=>Gg.safeParse(e).success,Lc=k({jsonrpc:O(ei),id:ti,result:Se}).strict(),ur=e=>Lc.safeParse(e).success;var N;(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"})(N||(N={}));var Uc=k({jsonrpc:O(ei),id:ti.optional(),error:k({code:X().int(),message:g(),data:ue().optional()})}).strict();var Yg=e=>Uc.safeParse(e).success;var Yr=ie([Wg,Gg,Lc,Uc]),XC=ie([Lc,Uc]),kt=Se.strict(),Xv=Ge.extend({requestId:ti.optional(),reason:g().optional()}),ri=Xe.extend({method:O("notifications/cancelled"),params:Xv}),Yv=k({src:g(),mimeType:g().optional(),sizes:z(g()).optional(),theme:Me(["light","dark"]).optional()}),Wn=k({icons:z(Yv).optional()}),Xr=k({name:g(),title:g().optional()}),Qg=Xr.extend({...Xr.shape,...Wn.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),Qv=Ws(k({applyDefaults:re().optional()}),oe(g(),ue())),e$=Zc(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ws(k({form:Qv.optional(),url:_e.optional()}),oe(g(),ue()).optional())),t$=ye({list:_e.optional(),cancel:_e.optional(),requests:ye({sampling:ye({createMessage:_e.optional()}).optional(),elicitation:ye({create:_e.optional()}).optional()}).optional()}),r$=ye({list:_e.optional(),cancel:_e.optional(),requests:ye({tools:ye({call:_e.optional()}).optional()}).optional()}),n$=k({experimental:oe(g(),_e).optional(),sampling:k({context:_e.optional(),tools:_e.optional()}).optional(),elicitation:e$.optional(),roots:k({listChanged:re().optional()}).optional(),tasks:t$.optional(),extensions:oe(g(),_e).optional()}),o$=Ke.extend({protocolVersion:g(),capabilities:n$,clientInfo:Qg}),qc=$e.extend({method:O("initialize"),params:o$});var s$=k({experimental:oe(g(),_e).optional(),logging:_e.optional(),completions:_e.optional(),prompts:k({listChanged:re().optional()}).optional(),resources:k({subscribe:re().optional(),listChanged:re().optional()}).optional(),tools:k({listChanged:re().optional()}).optional(),tasks:r$.optional(),extensions:oe(g(),_e).optional()}),Fc=Se.extend({protocolVersion:g(),capabilities:s$,serverInfo:Qg,instructions:g().optional()}),ni=Xe.extend({method:O("notifications/initialized"),params:Ge.optional()}),ey=e=>ni.safeParse(e).success,oi=$e.extend({method:O("ping"),params:Ke.optional()}),i$=k({progress:X(),total:le(X()),message:le(g())}),a$=k({...Ge.shape,...i$.shape,progressToken:Hg}),si=Xe.extend({method:O("notifications/progress"),params:a$}),c$=Ke.extend({cursor:Kg.optional()}),Gn=$e.extend({params:c$.optional()}),Xn=Se.extend({nextCursor:Kg.optional()}),u$=Me(["working","input_required","completed","failed","cancelled"]),Yn=k({taskId:g(),status:u$,ttl:ie([X(),Ag()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:le(X()),statusMessage:le(g())}),Pt=Se.extend({task:Yn}),l$=Ge.merge(Yn),Qn=Xe.extend({method:O("notifications/tasks/status"),params:l$}),ii=$e.extend({method:O("tasks/get"),params:Ke.extend({taskId:g()})}),ai=Se.merge(Yn),ci=$e.extend({method:O("tasks/result"),params:Ke.extend({taskId:g()})}),YC=Se.loose(),ui=Gn.extend({method:O("tasks/list")}),li=Xn.extend({tasks:z(Yn)}),di=$e.extend({method:O("tasks/cancel"),params:Ke.extend({taskId:g()})}),ty=Se.merge(Yn),ry=k({uri:g(),mimeType:le(g()),_meta:oe(g(),ue()).optional()}),ny=ry.extend({text:g()}),Bc=g().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),oy=ry.extend({blob:Bc}),eo=Me(["user","assistant"]),Qr=k({audience:z(eo).optional(),priority:X().min(0).max(1).optional(),lastModified:Gs.datetime({offset:!0}).optional()}),sy=k({...Xr.shape,...Wn.shape,uri:g(),description:le(g()),mimeType:le(g()),size:le(X()),annotations:Qr.optional(),_meta:le(ye({}))}),d$=k({...Xr.shape,...Wn.shape,uriTemplate:g(),description:le(g()),mimeType:le(g()),annotations:Qr.optional(),_meta:le(ye({}))}),f$=Gn.extend({method:O("resources/list")}),Vc=Xn.extend({resources:z(sy)}),p$=Gn.extend({method:O("resources/templates/list")}),Hc=Xn.extend({resourceTemplates:z(d$)}),Kc=Ke.extend({uri:g()}),h$=Kc,m$=$e.extend({method:O("resources/read"),params:h$}),Jc=Se.extend({contents:z(ie([ny,oy]))}),Wc=Xe.extend({method:O("notifications/resources/list_changed"),params:Ge.optional()}),g$=Kc,y$=$e.extend({method:O("resources/subscribe"),params:g$}),_$=Kc,b$=$e.extend({method:O("resources/unsubscribe"),params:_$}),w$=Ge.extend({uri:g()}),x$=Xe.extend({method:O("notifications/resources/updated"),params:w$}),v$=k({name:g(),description:le(g()),required:le(re())}),$$=k({...Xr.shape,...Wn.shape,description:le(g()),arguments:le(z(v$)),_meta:le(ye({}))}),S$=Gn.extend({method:O("prompts/list")}),Gc=Xn.extend({prompts:z($$)}),z$=Ke.extend({name:g(),arguments:oe(g(),g()).optional()}),k$=$e.extend({method:O("prompts/get"),params:z$}),Xc=k({type:O("text"),text:g(),annotations:Qr.optional(),_meta:oe(g(),ue()).optional()}),Yc=k({type:O("image"),data:Bc,mimeType:g(),annotations:Qr.optional(),_meta:oe(g(),ue()).optional()}),Qc=k({type:O("audio"),data:Bc,mimeType:g(),annotations:Qr.optional(),_meta:oe(g(),ue()).optional()}),P$=k({type:O("tool_use"),name:g(),id:g(),input:oe(g(),ue()),_meta:oe(g(),ue()).optional()}),E$=k({type:O("resource"),resource:ie([ny,oy]),annotations:Qr.optional(),_meta:oe(g(),ue()).optional()}),T$=sy.extend({type:O("resource_link")}),eu=ie([Xc,Yc,Qc,T$,E$]),O$=k({role:eo,content:eu}),tu=Se.extend({description:g().optional(),messages:z(O$)}),ru=Xe.extend({method:O("notifications/prompts/list_changed"),params:Ge.optional()}),R$=k({title:g().optional(),readOnlyHint:re().optional(),destructiveHint:re().optional(),idempotentHint:re().optional(),openWorldHint:re().optional()}),A$=k({taskSupport:Me(["required","optional","forbidden"]).optional()}),iy=k({...Xr.shape,...Wn.shape,description:g().optional(),inputSchema:k({type:O("object"),properties:oe(g(),_e).optional(),required:z(g()).optional()}).catchall(ue()),outputSchema:k({type:O("object"),properties:oe(g(),_e).optional(),required:z(g()).optional()}).catchall(ue()).optional(),annotations:R$.optional(),execution:A$.optional(),_meta:oe(g(),ue()).optional()}),nu=Gn.extend({method:O("tools/list")}),ou=Xn.extend({tools:z(iy)}),Bt=Se.extend({content:z(eu).default([]),structuredContent:oe(g(),ue()).optional(),isError:re().optional()}),QC=Bt.or(Se.extend({toolResult:ue()})),C$=Kn.extend({name:g(),arguments:oe(g(),ue()).optional()}),to=$e.extend({method:O("tools/call"),params:C$}),su=Xe.extend({method:O("notifications/tools/list_changed"),params:Ge.optional()}),ay=k({autoRefresh:re().default(!0),debounceMs:X().int().nonnegative().default(300)}),ro=Me(["debug","info","notice","warning","error","critical","alert","emergency"]),I$=Ke.extend({level:ro}),iu=$e.extend({method:O("logging/setLevel"),params:I$}),N$=Ge.extend({level:ro,logger:g().optional(),data:ue()}),j$=Xe.extend({method:O("notifications/message"),params:N$}),Z$=k({name:g().optional()}),D$=k({hints:z(Z$).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),M$=k({mode:Me(["auto","required","none"]).optional()}),L$=k({type:O("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:z(eu).default([]),structuredContent:k({}).loose().optional(),isError:re().optional(),_meta:oe(g(),ue()).optional()}),U$=jc("type",[Xc,Yc,Qc]),Ys=jc("type",[Xc,Yc,Qc,P$,L$]),q$=k({role:eo,content:ie([Ys,z(Ys)]),_meta:oe(g(),ue()).optional()}),F$=Kn.extend({messages:z(q$),modelPreferences:D$.optional(),systemPrompt:g().optional(),includeContext:Me(["none","thisServer","allServers"]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:z(g()).optional(),metadata:_e.optional(),tools:z(iy).optional(),toolChoice:M$.optional()}),au=$e.extend({method:O("sampling/createMessage"),params:F$}),lr=Se.extend({model:g(),stopReason:le(Me(["endTurn","stopSequence","maxTokens"]).or(g())),role:eo,content:U$}),no=Se.extend({model:g(),stopReason:le(Me(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:eo,content:ie([Ys,z(Ys)])}),B$=k({type:O("boolean"),title:g().optional(),description:g().optional(),default:re().optional()}),V$=k({type:O("string"),title:g().optional(),description:g().optional(),minLength:X().optional(),maxLength:X().optional(),format:Me(["email","uri","date","date-time"]).optional(),default:g().optional()}),H$=k({type:Me(["number","integer"]),title:g().optional(),description:g().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),K$=k({type:O("string"),title:g().optional(),description:g().optional(),enum:z(g()),default:g().optional()}),J$=k({type:O("string"),title:g().optional(),description:g().optional(),oneOf:z(k({const:g(),title:g()})),default:g().optional()}),W$=k({type:O("string"),title:g().optional(),description:g().optional(),enum:z(g()),enumNames:z(g()).optional(),default:g().optional()}),G$=ie([K$,J$]),X$=k({type:O("array"),title:g().optional(),description:g().optional(),minItems:X().optional(),maxItems:X().optional(),items:k({type:O("string"),enum:z(g())}),default:z(g()).optional()}),Y$=k({type:O("array"),title:g().optional(),description:g().optional(),minItems:X().optional(),maxItems:X().optional(),items:k({anyOf:z(k({const:g(),title:g()}))}),default:z(g()).optional()}),Q$=ie([X$,Y$]),eS=ie([W$,G$,Q$]),tS=ie([eS,B$,V$,H$]),rS=Kn.extend({mode:O("form").optional(),message:g(),requestedSchema:k({type:O("object"),properties:oe(g(),tS),required:z(g()).optional()})}),nS=Kn.extend({mode:O("url"),message:g(),elicitationId:g(),url:g().url()}),oS=ie([rS,nS]),cu=$e.extend({method:O("elicitation/create"),params:oS}),sS=Ge.extend({elicitationId:g()}),iS=Xe.extend({method:O("notifications/elicitation/complete"),params:sS}),Vt=Se.extend({action:Me(["accept","decline","cancel"]),content:Zc(e=>e===null?void 0:e,oe(g(),ie([g(),X(),re(),z(g())])).optional())}),aS=k({type:O("ref/resource"),uri:g()});var cS=k({type:O("ref/prompt"),name:g()}),uS=Ke.extend({ref:ie([cS,aS]),argument:k({name:g(),value:g()}),context:k({arguments:oe(g(),g()).optional()}).optional()}),lS=$e.extend({method:O("completion/complete"),params:uS});var uu=Se.extend({completion:ye({values:z(g()).max(100),total:le(X().int()),hasMore:le(re())})}),dS=k({uri:g().startsWith("file://"),name:g().optional(),_meta:oe(g(),ue()).optional()}),fS=$e.extend({method:O("roots/list"),params:Ke.optional()}),lu=Se.extend({roots:z(dS)}),pS=Xe.extend({method:O("notifications/roots/list_changed"),params:Ge.optional()}),eI=ie([oi,qc,lS,iu,k$,S$,f$,p$,m$,y$,b$,to,nu,ii,ci,ui,di]),tI=ie([ri,si,ni,pS,Qn]),rI=ie([kt,lr,no,Vt,lu,ai,li,Pt]),nI=ie([oi,au,cu,fS,ii,ci,ui,di]),oI=ie([ri,si,j$,x$,Wc,su,ru,Qn,iS]),sI=ie([kt,Fc,uu,tu,Gc,Vc,Hc,Jc,Bt,ou,ai,li,Pt]),R=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===N.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Dc(o.elicitations,r)}return new e(t,r,n)}},Dc=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(N.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Ht(e){return e==="completed"||e==="failed"||e==="cancelled"}var DI=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function du(e){let r=Wr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Gr(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function fu(e,t){let r=Ie(e,t);if(!r.success)throw r.error;return r.data}var bS=6e4,en=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(ri,r=>{this._oncancel(r)}),this.setNotificationHandler(si,r=>{this._onprogress(r)}),this.setRequestHandler(oi,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ii,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(N.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ci,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new R(N.InvalidParams,`Task not found: ${s}`);if(!Ht(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(Ht(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Ft]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(ui,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new R(N.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(di,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(N.InvalidParams,`Task not found: ${r.params.taskId}`);if(Ht(o.status))throw new R(N.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new R(N.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof R?o:new R(N.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});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 n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),ur(s)||Yg(s)?this._onresponse(s):Jn(s)?this._onrequest(s,i):Xg(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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(N.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(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(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[Ft]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:N.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=Jg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new R(N.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:N.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),ur(t))n(t);else{let i=new R(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===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(ur(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),ur(t))o(t);else{let i=R.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(N.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Pt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(N.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Ht(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new R(N.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(N.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(N.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=v=>{l(v)};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(v){d(v);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Ft]:c}});let h=v=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(v)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let $=v instanceof R?v:new R(N.RequestTimeout,String(v));l($)};this._responseHandlers.set(p,v=>{if(!n?.signal?.aborted){if(v instanceof Error)return l(v);try{let $=Ie(r,v.result);$.success?u($.data):l($.error)}catch($){l($)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let m=n?.timeout??bS,y=()=>h(R.fromError(N.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let v=$=>{let C=this._responseHandlers.get(p);C?C($):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(p),l($)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(v=>{this._cleanupTimeout(p),l(v)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},ai,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},li,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},ty,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Ft]:r.relatedTask}}};await this._enqueueTaskMessage(n,{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||{},[Ft]: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||{},[Ft]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=du(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=fu(t,o);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 n=du(t);this._notificationHandlers.set(n,o=>{let s=fu(t,o);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,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Jn(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new R(N.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){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new R(N.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(N.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new R(N.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Qn.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Ht(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new R(N.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Ht(a.status))throw new R(N.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Qn.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Ht(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function cy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function fi(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];cy(i)&&cy(s)?r[o]={...i,...s}:r[o]=s}return r}var ab=la(od(),1),cb=la(ib(),1);function OT(){let e=new ab.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,cb.default)(e),e}var bn=class{constructor(t){this._ajv=t??OT()}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 n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Wi=class{constructor(t){this._client=t}async*callToolStream(t,r=Bt,n){let o=this._client,s={...n,task:n?.task??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},r,s),a=o.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new R(N.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=a(u.structuredContent);if(!l.valid){yield{type:"error",error:new R(N.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof R){yield{type:"error",error:l};return}yield{type:"error",error:new R(N.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._client.getTaskResult({taskId:t},r,n)}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,n){return this._client.requestStream(t,r,n)}};function Gi(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 Xi(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 Yi(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[o]=s.default),r[o]!==void 0&&Yi(s,r[o])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&Yi(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&Yi(r,t)}}function RT(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 Qi=class extends en{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 bn,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",su,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",ru,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Wc,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Wi(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=fi(this._capabilities,t)}setRequestHandler(t,r){let o=Wr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Gr(o);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,u)=>{let l=Ie(cu,c);if(!l.success){let v=l.error instanceof Error?l.error.message:String(l.error);throw new R(N.InvalidParams,`Invalid elicitation request: ${v}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=RT(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new R(N.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new R(N.InvalidParams,"Client does not support URL-mode elicitation requests");let h=await Promise.resolve(r(c,u));if(d.task){let v=Ie(Pt,h);if(!v.success){let $=v.error instanceof Error?v.error.message:String(v.error);throw new R(N.InvalidParams,`Invalid task creation result: ${$}`)}return v.data}let m=Ie(Vt,h);if(!m.success){let v=m.error instanceof Error?m.error.message:String(m.error);throw new R(N.InvalidParams,`Invalid elicitation result: ${v}`)}let y=m.data,_=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&_&&this._capabilities.elicitation?.form?.applyDefaults)try{Yi(_,y.content)}catch{}return y};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=Ie(au,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new R(N.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let y=Ie(Pt,p);if(!y.success){let _=y.error instanceof Error?y.error.message:String(y.error);throw new R(N.InvalidParams,`Invalid task creation result: ${_}`)}return y.data}let h=d.tools||d.toolChoice?no:lr,m=Ie(h,p);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new R(N.InvalidParams,`Invalid sampling result: ${y}`)}return m.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 n=await this.request({method:"initialize",params:{protocolVersion:qt,capabilities:this._capabilities,clientInfo:this._clientInfo}},Fc,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Qs.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}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){Gi(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&Xi(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},kt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},uu,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},kt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},tu,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Gc,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Vc,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Hc,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Jc,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},kt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},kt,r)}async callTool(t,r=Bt,n){if(this.isToolTaskRequired(t.name))throw new R(N.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:t},r,n),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new R(N.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new R(N.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof R?i:new R(N.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}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 o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let n=await this.request({method:"tools/list",params:t},ou,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,o){let s=ay.safeParse(n);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let p=setTimeout(u,a);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var pb=la(fb(),1);function hb(e){if(e)try{return pb.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function ea(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function mb(e=fetch,t){return t?async(r,n)=>{let o={...t,...n,headers:n?.headers?{...ea(t.headers),...ea(n.headers)}:t.headers};return e(r,o)}:e}var pd;pd=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function LT(e){return(await pd).getRandomValues(new Uint8Array(e))}async function UT(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,n="";for(;n.length<e;){let o=await LT(e-n.length);for(let s of o)s<r&&(n+=t[s%t.length])}return n}async function qT(e){return await UT(e)}async function FT(e){let t=await(await pd).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function hd(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await qT(e),r=await FT(t);return{code_verifier:t,code_challenge:r}}var Ee=Og().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Vg.custom,message:"URL must be parseable",fatal:!0}),Fa}).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"}),yb=ye({resource:g().url(),authorization_servers:z(Ee).optional(),jwks_uri:g().url().optional(),scopes_supported:z(g()).optional(),bearer_methods_supported:z(g()).optional(),resource_signing_alg_values_supported:z(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:re().optional(),authorization_details_types_supported:z(g()).optional(),dpop_signing_alg_values_supported:z(g()).optional(),dpop_bound_access_tokens_required:re().optional()}),md=ye({issuer:g(),authorization_endpoint:Ee,token_endpoint:Ee,registration_endpoint:Ee.optional(),scopes_supported:z(g()).optional(),response_types_supported:z(g()),response_modes_supported:z(g()).optional(),grant_types_supported:z(g()).optional(),token_endpoint_auth_methods_supported:z(g()).optional(),token_endpoint_auth_signing_alg_values_supported:z(g()).optional(),service_documentation:Ee.optional(),revocation_endpoint:Ee.optional(),revocation_endpoint_auth_methods_supported:z(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:z(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(g()).optional(),code_challenge_methods_supported:z(g()).optional(),client_id_metadata_document_supported:re().optional()}),BT=ye({issuer:g(),authorization_endpoint:Ee,token_endpoint:Ee,userinfo_endpoint:Ee.optional(),jwks_uri:Ee,registration_endpoint:Ee.optional(),scopes_supported:z(g()).optional(),response_types_supported:z(g()),response_modes_supported:z(g()).optional(),grant_types_supported:z(g()).optional(),acr_values_supported:z(g()).optional(),subject_types_supported:z(g()),id_token_signing_alg_values_supported:z(g()),id_token_encryption_alg_values_supported:z(g()).optional(),id_token_encryption_enc_values_supported:z(g()).optional(),userinfo_signing_alg_values_supported:z(g()).optional(),userinfo_encryption_alg_values_supported:z(g()).optional(),userinfo_encryption_enc_values_supported:z(g()).optional(),request_object_signing_alg_values_supported:z(g()).optional(),request_object_encryption_alg_values_supported:z(g()).optional(),request_object_encryption_enc_values_supported:z(g()).optional(),token_endpoint_auth_methods_supported:z(g()).optional(),token_endpoint_auth_signing_alg_values_supported:z(g()).optional(),display_values_supported:z(g()).optional(),claim_types_supported:z(g()).optional(),claims_supported:z(g()).optional(),service_documentation:g().optional(),claims_locales_supported:z(g()).optional(),ui_locales_supported:z(g()).optional(),claims_parameter_supported:re().optional(),request_parameter_supported:re().optional(),request_uri_parameter_supported:re().optional(),require_request_uri_registration:re().optional(),op_policy_uri:Ee.optional(),op_tos_uri:Ee.optional(),client_id_metadata_document_supported:re().optional()}),_b=k({...BT.shape,...md.pick({code_challenge_methods_supported:!0}).shape}),bb=k({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:Xs.number().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),wb=k({error:g(),error_description:g().optional(),error_uri:g().optional()}),gb=Ee.optional().or(O("").transform(()=>{})),VT=k({redirect_uris:z(Ee),token_endpoint_auth_method:g().optional(),grant_types:z(g()).optional(),response_types:z(g()).optional(),client_name:g().optional(),client_uri:Ee.optional(),logo_uri:gb,scope:g().optional(),contacts:z(g()).optional(),tos_uri:gb,policy_uri:g().optional(),jwks_uri:Ee.optional(),jwks:Cg().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),HT=k({client_id:g(),client_secret:g().optional(),client_id_issued_at:X().optional(),client_secret_expires_at:X().optional(),issuer:g().optional().catch(void 0)}).strip(),xb=VT.merge(HT),pZ=k({error:g(),error_description:g().optional()}).strip(),hZ=k({token:g(),token_type_hint:g().optional()}).strip();function vb(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function $b({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var ge=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}},jo=class extends ge{};jo.errorCode="invalid_request";var $r=class extends ge{};$r.errorCode="invalid_client";var Sr=class extends ge{};Sr.errorCode="invalid_grant";var zr=class extends ge{};zr.errorCode="unauthorized_client";var Zo=class extends ge{};Zo.errorCode="unsupported_grant_type";var Do=class extends ge{};Do.errorCode="invalid_scope";var Mo=class extends ge{};Mo.errorCode="access_denied";var Ct=class extends ge{};Ct.errorCode="server_error";var Lo=class extends ge{};Lo.errorCode="temporarily_unavailable";var Uo=class extends ge{};Uo.errorCode="unsupported_response_type";var qo=class extends ge{};qo.errorCode="unsupported_token_type";var Fo=class extends ge{};Fo.errorCode="invalid_token";var Bo=class extends ge{};Bo.errorCode="method_not_allowed";var Vo=class extends ge{};Vo.errorCode="too_many_requests";var kr=class extends ge{};kr.errorCode="invalid_client_metadata";var Ho=class extends ge{};Ho.errorCode="insufficient_scope";var Ko=class extends ge{};Ko.errorCode="invalid_target";var Sb={[jo.errorCode]:jo,[$r.errorCode]:$r,[Sr.errorCode]:Sr,[zr.errorCode]:zr,[Zo.errorCode]:Zo,[Do.errorCode]:Do,[Mo.errorCode]:Mo,[Ct.errorCode]:Ct,[Lo.errorCode]:Lo,[Uo.errorCode]:Uo,[qo.errorCode]:qo,[Fo.errorCode]:Fo,[Bo.errorCode]:Bo,[Vo.errorCode]:Vo,[kr.errorCode]:kr,[Ho.errorCode]:Ho,[Ko.errorCode]:Ko};var It=class extends Error{constructor(t){super(t??"Unauthorized")}};function KT(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var gd="code",yd="S256";function JT(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&KT(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 WT(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":GT(o,s,r);return;case"client_secret_post":XT(o,s,n);return;case"none":YT(o,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function GT(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function XT(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function YT(e,t){t.set("client_id",e)}async function kb(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=wb.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=Sb[o]||Ct;return new a(s||"",i)}catch(n){let o=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ct(o)}}function QT(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function wd(e,t){if(e)return typeof e.issuer!="string"?e.issuer==null?e:{...e,issuer:void 0}:QT(e.issuer,t)?e:void 0}var eO=bb.omit({issuer:!0}),tO=xb.omit({issuer:!0});function Pb(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 Jo(e,t){try{return await _d(e,t)}catch(r){if(r instanceof $r||r instanceof zr)return await e.invalidateCredentials?.("all"),await _d(e,t);if(r instanceof Sr)return await e.invalidateCredentials?.("tokens"),await _d(e,t);throw r}}async function _d(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=o;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await Tb(c,{fetchFn:s}),!a)try{a=await Eb(t,{resourceMetadataUrl:l},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}else{let D=await cO(t,{resourceMetadataUrl:l,fetchFn:s});c=D.authorizationServerUrl,u=D.authorizationServerMetadata,a=D.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=String(c),p=await nO(t,e,a),f=p&&a&&!e.validateResourceURL?a.resource:p,h=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation()),y=wd(m,d),_=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(m&&!y&&!_)throw Pb(m,d);let v=y?.issuer==null?y:void 0,$=async()=>{try{v&&await e.saveClientInformation?.({...v,issuer:d})}catch{}};if(!y){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let D=u?.client_id_metadata_document_supported===!0,S=e.clientMetadataUrl;if(S&&!rO(S))throw new kr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${S}`);if(D&&S)y={client_id:S,issuer:d},await e.saveClientInformation?.(y);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");y={...await pO(c,{metadata:u,clientMetadata:e.clientMetadata,scope:h,fetchFn:s}),issuer:d},await e.saveClientInformation(y)}}let C=!e.redirectUrl;if(r!==void 0||C){let D=await fO(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:s});return await $(),await e.saveTokens({...D,issuer:d}),"AUTHORIZED"}let w=wd(await e.tokens(),d);if(w?.refresh_token&&w.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."),w?.refresh_token)try{let D=await dO(c,{metadata:u,clientInformation:y,refreshToken:w.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await $(),await e.saveTokens({...D,issuer:d}),"AUTHORIZED"}catch(D){if(!(!(D instanceof ge)||D instanceof Ct))throw D}let x=e.state?await e.state():void 0,{authorizationUrl:E,codeVerifier:W}=await uO(c,{metadata:u,clientInformation:y,state:x,redirectUrl:e.redirectUrl,scope:h,resource:f});return await e.saveCodeVerifier(W),await e.redirectToAuthorization(E),"REDIRECT"}function rO(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function nO(e,t,r){let n=vb(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(r){if(!$b({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function xd(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=bd(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=bd(e,"scope")||void 0,a=bd(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function bd(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function Eb(e,t,r=fetch){let n=await iO(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return yb.parse(await n.json())}async function vd(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?vd(e,void 0,r):void 0;throw n}}function oO(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function zb(e,t,r=fetch){return await vd(e,{"MCP-Protocol-Version":t},r)}function sO(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function iO(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??qt,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=oO(t,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await zb(i,s,r);if(!n?.metadataUrl&&sO(a,o.pathname)){let c=new URL(`/.well-known/${t}`,o);a=await zb(c,s,r)}return a}function aO(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function Tb(e,{fetchFn:t=fetch,protocolVersion:r=qt}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=aO(e);for(let{url:s,type:i}of o){let a=await vd(s,n,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?md.parse(await a.json()):_b.parse(await a.json())}}}async function cO(e,t){let r,n;try{r=await Eb(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));let o=await Tb(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function Ob(e){return typeof e=="string"?e:e.href}async function uO(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(gd))throw new Error(`Incompatible auth server: does not support response type ${gd}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(yd))throw new Error(`Incompatible auth server: does not support code challenge method ${yd}`)}else a=new URL("/authorize",e);let c=await hd(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",gd),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",yd),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",Ob(i)),{authorizationUrl:a,codeVerifier:u}}function lO(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Rb(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,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",Ob(s)),o)await o(c,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=JT(n,l);WT(d,n,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await kb(u);return eO.parse(await u.json())}async function dO(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await Rb(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function fO(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=wd(l,String(t));if(l&&!d)throw Pb(l,String(t));return d},a=await i(),c=e.clientMetadata.scope,u;if(e.prepareTokenRequest&&(u=await e.prepareTokenRequest(c)),!u){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();u=lO(o,l,e.redirectUrl)}return a??(a=await i()),Rb(t,{metadata:r,tokenRequestParams:u,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function pO(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){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(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await kb(i);return tO.parse(await i.json())}var Wo=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}},Ab=10,hO=13,Pr=32;function $d(e){}function Nb(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:n=$d,onComment:o,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l="",d=0,p,f=!1;function h(w){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,w.charCodeAt(0)===239&&w.charCodeAt(1)===187&&w.charCodeAt(2)===191&&(w=w.slice(3))),i.length===0){let W=y(w);W!==""&&(i.push(W),a=W.length),m();return}if(w.indexOf(`
|
|
70
|
+
`)===-1&&w.indexOf("\r")===-1){i.push(w),a+=w.length,m();return}i.push(w);let x=i.join("");i.length=0,a=0;let E=y(x);E!==""&&(i.push(E),a=E.length),m()}function m(){s!==void 0&&(a+l.length<=s||(f=!0,i.length=0,a=0,u=void 0,l="",d=0,p=void 0,r(new Wo(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function y(w){let x=0;if(w.indexOf("\r")===-1){let E=w.indexOf(`
|
|
71
|
+
`,x);for(;E!==-1;){if(x===E){d>0&&t({id:u,event:p,data:l}),u=void 0,l="",d=0,p=void 0,x=E+1,E=w.indexOf(`
|
|
72
|
+
`,x);continue}let W=w.charCodeAt(x);if(Cb(w,x,W)){let D=w.charCodeAt(x+5)===Pr?x+6:x+5,S=w.slice(D,E);if(d===0&&w.charCodeAt(E+1)===Ab){t({id:u,event:p,data:S}),u=void 0,l="",p=void 0,x=E+2,E=w.indexOf(`
|
|
73
|
+
`,x);continue}l=d===0?S:`${l}
|
|
74
|
+
${S}`,d++}else Ib(w,x,W)?p=w.slice(w.charCodeAt(x+6)===Pr?x+7:x+6,E)||void 0:_(w,x,E);x=E+1,E=w.indexOf(`
|
|
75
|
+
`,x)}return w.slice(x)}for(;x<w.length;){let E=w.indexOf("\r",x),W=w.indexOf(`
|
|
76
|
+
`,x),D=-1;if(E!==-1&&W!==-1?D=E<W?E:W:E!==-1?E===w.length-1?D=-1:D=E:W!==-1&&(D=W),D===-1)break;_(w,x,D),x=D+1,w.charCodeAt(x-1)===hO&&w.charCodeAt(x)===Ab&&x++}return w.slice(x)}function _(w,x,E){if(x===E){$();return}let W=w.charCodeAt(x);if(Cb(w,x,W)){let V=w.charCodeAt(x+5)===Pr?x+6:x+5,be=w.slice(V,E);l=d===0?be:`${l}
|
|
77
|
+
${be}`,d++;return}if(Ib(w,x,W)){p=w.slice(w.charCodeAt(x+6)===Pr?x+7:x+6,E)||void 0;return}if(W===105&&w.charCodeAt(x+1)===100&&w.charCodeAt(x+2)===58){let V=w.slice(w.charCodeAt(x+3)===Pr?x+4:x+3,E);V.includes("\0")||(u=V);return}if(W===58){if(o){let V=w.slice(x,E);o(V.slice(w.charCodeAt(x+1)===Pr?2:1))}return}let D=w.slice(x,E),S=D.indexOf(":");if(S===-1){v(D,"",D);return}let T=D.slice(0,S),M=D.charCodeAt(S+1)===Pr?2:1,F=D.slice(S+M);v(T,F,D)}function v(w,x,E){switch(w){case"event":p=x||void 0;break;case"data":l=d===0?x:`${l}
|
|
78
|
+
${x}`,d++;break;case"id":x.includes("\0")||(u=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Wo(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:E}));break;default:r(new Wo(`Unknown field "${w.length>20?`${w.slice(0,20)}\u2026`:w}"`,{type:"unknown-field",field:w,value:x,line:E}));break}}function $(){d>0&&t({id:u,event:p,data:l}),u=void 0,l="",d=0,p=void 0}function C(w={}){if(w.consume&&i.length>0){let x=i.join("");_(x,0,x.length)}c=!0,u=void 0,l="",d=0,p=void 0,i.length=0,a=0,f=!1}return{feed:h,reset:C}}function Cb(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 Ib(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 ta=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=Nb({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:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var mO={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},tr=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},ra=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=mb(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??mO}async _authThenStart(){if(!this._authProvider)throw new It("No auth provider");let t;try{t=await Jo(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 It;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=ea(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new tr(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,t,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),o)}_scheduleReconnection(t,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=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)})},o)}_handleSseStream(t,r,n){if(!t)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new ta({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:h}=await l.read();if(h)break;if(f.id&&(i=f.id,a=!0,o?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let m=Yr.parse(JSON.parse(f.data));ur(m)&&(c=!0,s!==void 0&&(m.id=s)),this.onmessage?.(m)}catch(m){this.onerror?.(m)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,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 It("No auth provider");if(await Jo(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new It("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:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Jn(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(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 tr(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:h,scope:m}=xd(a);if(this._resourceMetadataUrl=h,this._scope=m,await Jo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new It;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:h,scope:m,error:y}=xd(a);if(y==="insufficient_scope"){let _=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===_)throw new tr(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),h&&(this._resourceMetadataUrl=h),this._lastUpscopingHeader=_??void 0,await Jo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new It;return this.send(t)}}throw new tr(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),ey(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let l=(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"),p=hb(d);if(l)if(p==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(p==="application/json"){let f=await a.json(),h=Array.isArray(f)?f.map(m=>Yr.parse(m)):[Yr.parse(f)];for(let m of h)this.onmessage?.(m)}else throw await a.body?.cancel(),new tr(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}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},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new tr(n.status,`Failed to terminate session: ${n.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})}};var na=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},lr,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Vt,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};var oa=class extends en{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ro.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new bn,this.setRequestHandler(qc,n=>this._oninitialize(n)),this.setNotificationHandler(ni,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(iu,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=ro.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new na(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=fi(this._capabilities,t)}setRequestHandler(t,r){let o=Wr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Gr(o);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Ie(to,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new R(N.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=Ie(Pt,p);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new R(N.InvalidParams,`Invalid task creation result: ${m}`)}return h.data}let f=Ie(Bt,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new R(N.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Xi(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Gi(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Qs.includes(r)?r:qt,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},kt)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},no,r):this.request({method:"sampling/createMessage",params:t},lr,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Vt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Vt,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new R(N.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(N.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},lu,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import Zb from"node:process";var gO=10*1024*1024,sa=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??gO}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(`
|
|
79
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),yO(r)}clear(){this._buffer=void 0}};function yO(e){return Yr.parse(JSON.parse(e))}function jb(e){return JSON.stringify(e)+`
|
|
80
|
+
`}var ia=class{constructor(t=Zb.stdin,r=Zb.stdout,n){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=o=>{try{this._readBuffer.append(o),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=o=>{this.onerror?.(o)},this._readBuffer=new sa({maxBufferSize:n?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=jb(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var wO=64*1024;globalThis.crypto||(globalThis.crypto=_O);var aa=e=>process.stderr.write(`[jotbus] ${e}
|
|
81
|
+
`);function Sd(e){aa(e),process.exit(1)}async function zd(e){let t=process.env.JOTBUS_TOKEN;t||Sd("Missing JOTBUS_TOKEN. Copy the connection string from the dashboard when you mint a token.");let r;try{r=Jd(t)}catch{Sd("JOTBUS_TOKEN is not a valid Jotbus token or connection string.")}r.token||Sd("JOTBUS_TOKEN contains only a key; use the full connection string from the dashboard.");let n=r.token,o=r.key?await On(r.key):null,s=S=>S.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");function i(S){if(process.env.JOTBUS_AGENT)return process.env.JOTBUS_AGENT.slice(0,64);let T=s(S??""),M=/claude/.test(T)?"claude":/codex/.test(T)?"codex":/cursor/.test(T)?"cursor":T.split("-")[0]||"agent",F=s(bO().split(".")[0].replace(/-?(local|lan|home)$/i,""))||"machine";return`${M}-${F}`.slice(0,64)}let a=null;async function c(){if(a)return a;let S=new Qi({name:"jotbus",version:or});return await S.connect(new ra(new URL(e),{requestInit:{headers:{Authorization:`Bearer ${n}`,"x-jotbus-e2e":"1",...o?{"x-jotbus-key-check":o.check}:{},"User-Agent":`jotbus/${or}`}}})),a=S,S}async function u(S,T){try{return await(await c()).callTool({name:S,arguments:T})}catch(M){throw a=null,M}}let l=S=>S.content?.[0]?.type==="text"?S.content[0].text:"",d=S=>({content:[{type:"text",text:JSON.stringify(S,null,2)}]}),p=S=>({isError:!0,content:[{type:"text",text:S}]}),f=e.replace(/\/mcp\/?$/,""),h=()=>`${f}/claim#${t}`;function m(S,T){if(S.isError||!T)return S;let M;try{M=JSON.parse(l(S))}catch{return S}let F="expires_at"in M?M.expires_at:T.expires_at;if(!F)return S;let V=Math.ceil((new Date(F).getTime()-Date.now())/6e4);if(V>20)return S;let be=h(),xn=V<=0?"This temporary Jotbus workspace has expired.":`This temporary Jotbus workspace expires in ${V} minute${V===1?"":"s"}. `+(T.created_by_you?`Tell the user: to keep it (with its history and connected agents), they can open ${be}`:"Tell the user: whoever created it can keep it with the link `npx jotbus` printed, or start a new one with `npx jotbus`.");return d({...M,notice:xn})}let y=null;async function _(S=!1){if(y&&!S)return y;let T=await u("list_workspaces",{});if(T.isError)throw new Error(l(T));return y=JSON.parse(l(T)),y}async function v(S){let T=await _();if(S==null||S==="")return T.length===1?T[0]:void 0;let M=String(S).trim();return T.find(F=>F.id===M)??T.find(F=>F.name===M.toLowerCase())}function $(S){return S.encrypted?o?o.check!==S.key_check?`The encryption key in JOTBUS_TOKEN doesn't match workspace "${S.name}". Mint a new token from a browser where the workspace is unlocked.`:null:`Workspace "${S.name}" is end-to-end encrypted, but JOTBUS_TOKEN has no key. Use the full connection string (token.key) shown when the token was minted.`:null}async function C(S){if(S.isError)return S;let T=JSON.parse(l(S));if(!T.encrypted)return S;let M=(await _()).find(V=>V.id===T.workspace_id),F=M?$(M):"Unknown workspace";return F?p(F):(T.messages=await Promise.all(T.messages.map(async V=>{if(!Kd(V.content))return{...V,content:"[unreadable: not an encrypted message]"};try{let be=await o.decrypt(T.workspace_id,V.content);return{...V,author:be.a??V.author,content:be.c,metadata:be.m??null}}catch{return{...V,content:"[unreadable: could not decrypt with this key]"}}})),delete T.workspace_id,d(T))}async function w(S,T){switch(S){case"list_workspaces":{let M=await _(!0);return d(M.map(({key_check:F,...V},be)=>({...V,...V.encrypted?{key_ok:!$(M[be])}:{}})))}case"write_workspace":{let M=typeof T.author=="string"&&T.author.trim()||W(),F=await v(T.workspace);if(!F?.encrypted)return u(S,{...T,author:M});let V=$(F);if(V)return p(V);let be=String(T.content??"");if(!be.trim())return p("content must be a non-empty string");if(Buffer.byteLength(be)>wO)return p("Message is too large; the maximum is 64 KB of text.");let xn=T.metadata,kd=await o.encrypt(F.id,{c:be,a:M,...xn?{m:xn}:{}}),{metadata:Pd,author:zO,...Mb}=T;return m(await u(S,{...Mb,workspace:F.id,content:kd}),F)}case"invite_to_workspace":{let M=await v(T.workspace);if(M&&!M.encrypted)return p("Invites are available for end-to-end encrypted workspaces. Share an install command from the dashboard instead.");if(M?.encrypted&&$(M))return p($(M));let F=await u(S,{...T,...M?{workspace:M.id}:{}});if(F.isError)return F;let V=JSON.parse(l(F)),be=`${V.invite_secret}.${r.key}`,{invite_secret:xn,workspace_id:kd,...Pd}=V;return d({...Pd,join_command:`npx jotbus@latest join ${be}`,join_link:`${f}/join#${be}`,tell_the_user:`Send the join command (or link) privately; it contains the workspace's encryption key. The other person runs it in a terminal on their machine (Node 20+, no account needed), then starts a new agent session and says "Use Jotbus to collaborate."`})}case"jotbus_help":{let M=await u(S,T);if(M.isError)return M;let F=(await _())[0],V=[];return F?.temporary&&F.created_by_you?V.push(`This connection created the temporary workspace "${F.name}". Link to keep it (give it to the user only if they want to keep the workspace): ${h()}`):F?.temporary&&V.push(`"${F.name}" is a temporary workspace created by someone else; only its creator can keep it.`),{content:[{type:"text",text:l(M)+(V.length?`
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
## This connection
|
|
84
|
+
${V.join(`
|
|
85
|
+
`)}`:"")}]}}case"read_workspace":case"listen_workspace":return m(await C(await u(S,T)),await v(T.workspace));default:return u(S,T)}}let x="Shared scratchpad for coding agents (Jotbus).";try{x=(await c()).getInstructions()??x;let T=await _();for(let M of T){let F=$(M);F&&aa(F)}aa(`connected: ${T.length} workspace(s)${T.some(M=>M.encrypted)?", end-to-end encrypted":""}`)}catch(S){aa(`could not reach ${e} yet (${S.message}); will retry on first use`)}o&&(x+=`
|
|
86
|
+
|
|
87
|
+
Messages in encrypted workspaces are encrypted and decrypted on this machine; the server only stores ciphertext. Still never post secrets.`),x=x.replace(/\n*Other agents see your messages as written by[^\n]*/,"");let E=new oa({name:"jotbus",version:or},{capabilities:{tools:{}},instructions:x}),W=()=>i(E.getClientVersion()?.name);E.setRequestHandler(nu,async()=>{let{tools:S}=await(await c()).listTools();return{tools:S.map(T=>T.name==="write_workspace"?{...T,description:`${T.description} You appear to other agents as "${W()}"; they can @mention you as @${W()}.`+(o?" In encrypted workspaces the text is encrypted on this machine before upload.":"")}:T)}}),E.setRequestHandler(to,async S=>{try{return await w(S.params.name,S.params.arguments??{})}catch(T){return p(`Jotbus request failed: ${T.message}`)}});let D=()=>process.exit(0);process.stdin.on("end",D),process.stdin.on("close",D),E.onclose=D,await E.connect(new ia)}globalThis.crypto||(globalThis.crypto=xO);var{values:wn,positionals:$O}=vO({allowPositionals:!0,strict:!1,options:{url:{type:"string"},origin:{type:"string"},yes:{type:"boolean",short:"y"},"no-install":{type:"boolean"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}}),Db=`jotbus ${or}: a shared, end-to-end encrypted scratchpad for your coding agents
|
|
84
88
|
|
|
85
89
|
Try it now (no account):
|
|
86
90
|
npx jotbus create a temporary workspace (60 min) and connect your agents
|
|
@@ -91,13 +95,13 @@ Options:
|
|
|
91
95
|
--no-install just print the commands instead of configuring Claude Code / Codex
|
|
92
96
|
-h, --help, -v, --version
|
|
93
97
|
|
|
94
|
-
Persistent workspaces: sign in at ${
|
|
98
|
+
Persistent workspaces: sign in at ${sr} and paste the install command it shows.
|
|
95
99
|
|
|
96
100
|
When launched by an agent this runs the MCP server:
|
|
97
101
|
JOTBUS_TOKEN connection string (jb_live_<token>.<key>)
|
|
98
102
|
JOTBUS_AGENT name other agents see (default: <agent>-<hostname>, e.g. claude-macbook)
|
|
99
|
-
--url MCP endpoint (or JOTBUS_URL). Default: ${
|
|
100
|
-
`,[
|
|
101
|
-
`);else if(
|
|
103
|
+
--url MCP endpoint (or JOTBUS_URL). Default: ${ls}
|
|
104
|
+
`,[Er,...SO]=$O;if(wn.version)process.stdout.write(`${or}
|
|
105
|
+
`);else if(wn.help||Er==="help")process.stdout.write(Db);else{let e=wn.url??process.env.JOTBUS_URL,r={origin:(wn.origin??process.env.JOTBUS_ORIGIN??e?.replace(/\/mcp\/?$/,"")??sr).replace(/\/$/,""),yes:!!wn.yes,install:!wn["no-install"]};Er==="join"?await of(r,SO[0]):Er==="new"||Er==="create"?await Ea(r):Er==="mcp"?await zd(e??ls):Er?(process.stderr.write(`Unknown command "${Er}".
|
|
102
106
|
|
|
103
|
-
${
|
|
107
|
+
${Db}`),process.exit(1)):process.stdin.isTTY&&!process.env.JOTBUS_TOKEN?await Ea(r):await zd(e??ls)}
|