sap-abap-mcp 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.
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var bg=Object.create;var Qo=Object.defineProperty;var vg=Object.getOwnPropertyDescriptor;var $g=Object.getOwnPropertyNames;var wg=Object.getPrototypeOf,xg=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),yc=(t,e)=>{for(var r in e)Qo(t,r,{get:e[r],enumerable:!0})},Sg=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $g(e))!xg.call(t,o)&&o!==r&&Qo(t,o,{get:()=>e[o],enumerable:!(n=vg(e,o))||n.enumerable});return t};var Dt=(t,e,r)=>(r=t!=null?bg(wg(t)):{},Sg(e||!t||!t.__esModule?Qo(r,"default",{value:t,enumerable:!0}):r,t));var Gr=v(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.regexpCode=D.getEsmExportName=D.getProperty=D.safeStringify=D.stringify=D.strConcat=D.addCodeArg=D.str=D._=D.nil=D._Code=D.Name=D.IDENTIFIER=D._CodeOrName=void 0;var Jr=class{};D._CodeOrName=Jr;D.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kt=class extends Jr{constructor(e){if(super(),!D.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};D.Name=kt;var je=class extends Jr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof kt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};D._Code=je;D.nil=new je("");function Ip(t,...e){let r=[t[0]],n=0;for(;n<e.length;)pi(r,e[n]),r.push(t[++n]);return new je(r)}D._=Ip;var di=new je("+");function Cp(t,...e){let r=[Hr(t[0])],n=0;for(;n<e.length;)r.push(di),pi(r,e[n]),r.push(di,Hr(t[++n]));return Bb(r),new je(r)}D.str=Cp;function pi(t,e){e instanceof je?t.push(...e._items):e instanceof kt?t.push(e):t.push(Gb(e))}D.addCodeArg=pi;function Bb(t){let e=1;for(;e<t.length-1;){if(t[e]===di){let r=Jb(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Jb(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof kt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof kt))return`"${t}${e.slice(1)}`}function Hb(t,e){return e.emptyStr()?t:t.emptyStr()?e:Cp`${t}${e}`}D.strConcat=Hb;function Gb(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Hr(Array.isArray(t)?t.join(","):t)}function Kb(t){return new je(Hr(t))}D.stringify=Kb;function Hr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}D.safeStringify=Hr;function Wb(t){return typeof t=="string"&&D.IDENTIFIER.test(t)?new je(`.${t}`):Ip`[${t}]`}D.getProperty=Wb;function Yb(t){if(typeof t=="string"&&D.IDENTIFIER.test(t))return new je(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}D.getEsmExportName=Yb;function Xb(t){return new je(t.toString())}D.regexpCode=Xb});var hi=v(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.ValueScope=ke.ValueScopeName=ke.Scope=ke.varKinds=ke.UsedValueState=void 0;var ze=Gr(),fi=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},ao;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(ao||(ke.UsedValueState=ao={}));ke.varKinds={const:new ze.Name("const"),let:new ze.Name("let"),var:new ze.Name("var")};var co=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ze.Name?e:this.name(e)}name(e){return new ze.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ke.Scope=co;var uo=class extends ze.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,ze._)`.${new ze.Name(r)}[${n}]`}};ke.ValueScopeName=uo;var Qb=(0,ze._)`\n`,mi=class extends co{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Qb:ze.nil}}get(){return this._scope}name(e){return new uo(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{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(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,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._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=ze.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ao.Started);let l=r(u);if(l){let d=this.opts.es5?ke.varKinds.var:ke.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 fi(u);c.set(u,ao.Completed)})}return s}};ke.ValueScope=mi});var R=v(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.or=A.and=A.not=A.CodeGen=A.operators=A.varKinds=A.ValueScopeName=A.ValueScope=A.Scope=A.Name=A.regexpCode=A.stringify=A.getProperty=A.nil=A.strConcat=A.str=A._=void 0;var Z=Gr(),De=hi(),ht=Gr();Object.defineProperty(A,"_",{enumerable:!0,get:function(){return ht._}});Object.defineProperty(A,"str",{enumerable:!0,get:function(){return ht.str}});Object.defineProperty(A,"strConcat",{enumerable:!0,get:function(){return ht.strConcat}});Object.defineProperty(A,"nil",{enumerable:!0,get:function(){return ht.nil}});Object.defineProperty(A,"getProperty",{enumerable:!0,get:function(){return ht.getProperty}});Object.defineProperty(A,"stringify",{enumerable:!0,get:function(){return ht.stringify}});Object.defineProperty(A,"regexpCode",{enumerable:!0,get:function(){return ht.regexpCode}});Object.defineProperty(A,"Name",{enumerable:!0,get:function(){return ht.Name}});var mo=hi();Object.defineProperty(A,"Scope",{enumerable:!0,get:function(){return mo.Scope}});Object.defineProperty(A,"ValueScope",{enumerable:!0,get:function(){return mo.ValueScope}});Object.defineProperty(A,"ValueScopeName",{enumerable:!0,get:function(){return mo.ValueScopeName}});Object.defineProperty(A,"varKinds",{enumerable:!0,get:function(){return mo.varKinds}});A.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var nt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},gi=class extends nt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?De.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=er(this.rhs,e,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},lo=class extends nt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=er(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return fo(e,this.rhs)}},_i=class extends lo{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},yi=class extends nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},bi=class extends nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},vi=class extends nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},$i=class extends nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=er(this.code,e,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Kr=class extends nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(ev(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Tt(e,r.names),{})}},ot=class extends Kr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},wi=class extends Kr{},Qt=class extends ot{};Qt.kind="else";var Pt=class t extends ot{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Qt(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(jp(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=er(this.condition,e,r),this}get names(){let e=super.names;return fo(e,this.condition),this.else&&Tt(e,this.else.names),e}};Pt.kind="if";var Et=class extends ot{};Et.kind="for";var xi=class extends Et{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=er(this.iteration,e,r),this}get names(){return Tt(super.names,this.iteration.names)}},Si=class extends Et{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?De.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=fo(super.names,this.from);return fo(e,this.to)}},po=class extends Et{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=er(this.iterable,e,r),this}get names(){return Tt(super.names,this.iterable.names)}},Wr=class extends ot{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Wr.kind="func";var Yr=class extends Kr{render(e){return"return "+super.render(e)}};Yr.kind="return";var zi=class extends ot{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Tt(e,this.catch.names),this.finally&&Tt(e,this.finally.names),e}},Xr=class extends ot{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Xr.kind="catch";var Qr=class extends ot{render(e){return"finally"+super.render(e)}};Qr.kind="finally";var ki=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=e,this._scope=new De.Scope({parent:e}),this._nodes=[new wi]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new gi(e,s,n)),s}const(e,r,n){return this._def(De.varKinds.const,e,r,n)}let(e,r,n){return this._def(De.varKinds.let,e,r,n)}var(e,r,n){return this._def(De.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new lo(e,r,n))}add(e,r){return this._leafNode(new _i(e,A.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Z.nil&&this._leafNode(new $i(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,o));return r.push("}"),new Z._Code(r)}if(e,r,n){if(this._blockNode(new Pt(e)),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(e){return this._elseNode(new Pt(e))}else(){return this._elseNode(new Qt)}endIf(){return this._endBlockNode(Pt,Qt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new xi(e),r)}forRange(e,r,n,o,s=this.opts.es5?De.varKinds.var:De.varKinds.let){let i=this._scope.toName(e);return this._for(new Si(s,i,r,n),()=>o(i))}forOf(e,r,n,o=De.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),n(s)})}return this._for(new po("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?De.varKinds.var:De.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Z._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new po("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Et)}label(e){return this._leafNode(new yi(e))}break(e){return this._leafNode(new bi(e))}return(e){let r=new Yr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Yr)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new zi;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Xr(s),r(s)}return n&&(this._currNode=o.finally=new Qr,this.code(n)),this._endBlockNode(Xr,Qr)}throw(e){return this._leafNode(new vi(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Z.nil,n,o){return this._blockNode(new Wr(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Wr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Pt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};A.CodeGen=ki;function Tt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function fo(t,e){return e instanceof Z._CodeOrName?Tt(t,e.names):t}function er(t,e,r){if(t instanceof Z.Name)return n(t);if(!o(t))return t;return new Z._Code(t._items.reduce((s,i)=>(i instanceof Z.Name&&(i=n(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function ev(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function jp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Z._)`!${Pi(t)}`}A.not=jp;var tv=Zp(A.operators.AND);function rv(...t){return t.reduce(tv)}A.and=rv;var nv=Zp(A.operators.OR);function ov(...t){return t.reduce(nv)}A.or=ov;function Zp(t){return(e,r)=>e===Z.nil?r:r===Z.nil?e:(0,Z._)`${Pi(e)} ${t} ${Pi(r)}`}function Pi(t){return t instanceof Z.Name?t:(0,Z._)`(${t})`}});var M=v(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.checkStrictMode=I.getErrorPath=I.Type=I.useFunc=I.setEvaluated=I.evaluatedPropsToName=I.mergeEvaluated=I.eachItem=I.unescapeJsonPointer=I.escapeJsonPointer=I.escapeFragment=I.unescapeFragment=I.schemaRefOrVal=I.schemaHasRulesButRef=I.schemaHasRules=I.checkUnknownRules=I.alwaysValidSchema=I.toHash=void 0;var J=R(),sv=Gr();function iv(t){let e={};for(let r of t)e[r]=!0;return e}I.toHash=iv;function av(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Lp(t,e),!Dp(e,t.self.RULES.all))}I.alwaysValidSchema=av;function Lp(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||Vp(t,`unknown keyword: "${s}"`)}I.checkUnknownRules=Lp;function Dp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}I.schemaHasRules=Dp;function cv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}I.schemaHasRulesButRef=cv;function uv({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,J._)`${r}`}return(0,J._)`${t}${e}${(0,J.getProperty)(n)}`}I.schemaRefOrVal=uv;function lv(t){return Up(decodeURIComponent(t))}I.unescapeFragment=lv;function dv(t){return encodeURIComponent(Ti(t))}I.escapeFragment=dv;function Ti(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}I.escapeJsonPointer=Ti;function Up(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}I.unescapeJsonPointer=Up;function pv(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}I.eachItem=pv;function qp({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof J.Name?(s instanceof J.Name?t(o,s,i):e(o,s,i),i):s instanceof J.Name?(e(o,i,s),s):r(s,i);return a===J.Name&&!(c instanceof J.Name)?n(o,c):c}}I.mergeEvaluated={props:qp({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,J._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,J._)`${r} || {}`),Ni(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Fp}),items:qp({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,J._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,J._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Fp(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,J._)`{}`);return e!==void 0&&Ni(t,r,e),r}I.evaluatedPropsToName=Fp;function Ni(t,e,r){Object.keys(r).forEach(n=>t.assign((0,J._)`${e}${(0,J.getProperty)(n)}`,!0))}I.setEvaluated=Ni;var Mp={};function fv(t,e){return t.scopeValue("func",{ref:e,code:Mp[e.code]||(Mp[e.code]=new sv._Code(e.code))})}I.useFunc=fv;var Ei;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ei||(I.Type=Ei={}));function mv(t,e,r){if(t instanceof J.Name){let n=e===Ei.Num;return r?n?(0,J._)`"[" + ${t} + "]"`:(0,J._)`"['" + ${t} + "']"`:n?(0,J._)`"/" + ${t}`:(0,J._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(t).toString():"/"+Ti(t)}I.getErrorPath=mv;function Vp(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}I.checkStrictMode=Vp});var st=v(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var ge=R(),hv={data:new ge.Name("data"),valCxt:new ge.Name("valCxt"),instancePath:new ge.Name("instancePath"),parentData:new ge.Name("parentData"),parentDataProperty:new ge.Name("parentDataProperty"),rootData:new ge.Name("rootData"),dynamicAnchors:new ge.Name("dynamicAnchors"),vErrors:new ge.Name("vErrors"),errors:new ge.Name("errors"),this:new ge.Name("this"),self:new ge.Name("self"),scope:new ge.Name("scope"),json:new ge.Name("json"),jsonPos:new ge.Name("jsonPos"),jsonLen:new ge.Name("jsonLen"),jsonPart:new ge.Name("jsonPart")};Oi.default=hv});var en=v(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.extendErrors=_e.resetErrorsCount=_e.reportExtraError=_e.reportError=_e.keyword$DataError=_e.keywordError=void 0;var L=R(),ho=M(),$e=st();_e.keywordError={message:({keyword:t})=>(0,L.str)`must pass "${t}" keyword validation`};_e.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,L.str)`"${t}" keyword must be ${e} ($data)`:(0,L.str)`"${t}" keyword is invalid ($data)`};function gv(t,e=_e.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=Hp(t,e,r);n??(i||a)?Bp(s,c):Jp(o,(0,L._)`[${c}]`)}_e.reportError=gv;function _v(t,e=_e.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=Hp(t,e,r);Bp(o,a),s||i||Jp(n,$e.default.vErrors)}_e.reportExtraError=_v;function yv(t,e){t.assign($e.default.errors,e),t.if((0,L._)`${$e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,L._)`${$e.default.vErrors}.length`,e),()=>t.assign($e.default.vErrors,null)))}_e.resetErrorsCount=yv;function bv({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,$e.default.errors,a=>{t.const(i,(0,L._)`${$e.default.vErrors}[${a}]`),t.if((0,L._)`${i}.instancePath === undefined`,()=>t.assign((0,L._)`${i}.instancePath`,(0,L.strConcat)($e.default.instancePath,s.errorPath))),t.assign((0,L._)`${i}.schemaPath`,(0,L.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,L._)`${i}.schema`,r),t.assign((0,L._)`${i}.data`,n))})}_e.extendErrors=bv;function Bp(t,e){let r=t.const("err",e);t.if((0,L._)`${$e.default.vErrors} === null`,()=>t.assign($e.default.vErrors,(0,L._)`[${r}]`),(0,L._)`${$e.default.vErrors}.push(${r})`),t.code((0,L._)`${$e.default.errors}++`)}function Jp(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,L._)`new ${t.ValidationError}(${e})`):(r.assign((0,L._)`${n}.errors`,e),r.return(!1))}var Nt={keyword:new L.Name("keyword"),schemaPath:new L.Name("schemaPath"),params:new L.Name("params"),propertyName:new L.Name("propertyName"),message:new L.Name("message"),schema:new L.Name("schema"),parentSchema:new L.Name("parentSchema")};function Hp(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,L._)`{}`:vv(t,e,r)}function vv(t,e,r={}){let{gen:n,it:o}=t,s=[$v(o,r),wv(t,r)];return xv(t,e,s),n.object(...s)}function $v({errorPath:t},{instancePath:e}){let r=e?(0,L.str)`${t}${(0,ho.getErrorPath)(e,ho.Type.Str)}`:t;return[$e.default.instancePath,(0,L.strConcat)($e.default.instancePath,r)]}function wv({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,L.str)`${e}/${t}`;return r&&(o=(0,L.str)`${o}${(0,ho.getErrorPath)(r,ho.Type.Str)}`),[Nt.schemaPath,o]}function xv(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Nt.keyword,o],[Nt.params,typeof e=="function"?e(t):e||(0,L._)`{}`]),c.messages&&n.push([Nt.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Nt.schema,i],[Nt.parentSchema,(0,L._)`${l}${d}`],[$e.default.data,s]),u&&n.push([Nt.propertyName,u])}});var Kp=v(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.boolOrEmptySchema=tr.topBoolOrEmptySchema=void 0;var Sv=en(),zv=R(),kv=st(),Pv={message:"boolean schema is false"};function Ev(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Gp(t,!1):typeof r=="object"&&r.$async===!0?e.return(kv.default.data):(e.assign((0,zv._)`${n}.errors`,null),e.return(!0))}tr.topBoolOrEmptySchema=Ev;function Tv(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Gp(t)):r.var(e,!0)}tr.boolOrEmptySchema=Tv;function Gp(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Sv.reportError)(o,Pv,void 0,e)}});var Ri=v(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.getRules=rr.isJSONType=void 0;var Nv=["string","number","integer","boolean","null","object","array"],Ov=new Set(Nv);function Rv(t){return typeof t=="string"&&Ov.has(t)}rr.isJSONType=Rv;function Av(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}rr.getRules=Av});var Ai=v(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.shouldUseRule=gt.shouldUseGroup=gt.schemaHasRulesForType=void 0;function Iv({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Wp(t,n)}gt.schemaHasRulesForType=Iv;function Wp(t,e){return e.rules.some(r=>Yp(t,r))}gt.shouldUseGroup=Wp;function Yp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}gt.shouldUseRule=Yp});var tn=v(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.reportTypeError=ye.checkDataTypes=ye.checkDataType=ye.coerceAndCheckDataType=ye.getJSONTypes=ye.getSchemaTypes=ye.DataType=void 0;var Cv=Ri(),jv=Ai(),Zv=en(),O=R(),Xp=M(),nr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(nr||(ye.DataType=nr={}));function qv(t){let e=Qp(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}ye.getSchemaTypes=qv;function Qp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Cv.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ye.getJSONTypes=Qp;function Mv(t,e){let{gen:r,data:n,opts:o}=t,s=Lv(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,jv.schemaHasRulesForType)(t,e[0]));if(i){let a=Ci(e,n,o.strictNumbers,nr.Wrong);r.if(a,()=>{s.length?Dv(t,e,s):ji(t)})}return i}ye.coerceAndCheckDataType=Mv;var ef=new Set(["string","number","integer","boolean","null"]);function Lv(t,e){return e?t.filter(r=>ef.has(r)||e==="array"&&r==="array"):[]}function Dv(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,O._)`typeof ${o}`),a=n.let("coerced",(0,O._)`undefined`);s.coerceTypes==="array"&&n.if((0,O._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,O._)`${o}[0]`).assign(i,(0,O._)`typeof ${o}`).if(Ci(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,O._)`${a} !== undefined`);for(let u of r)(ef.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),ji(t),n.endIf(),n.if((0,O._)`${a} !== undefined`,()=>{n.assign(o,a),Uv(t,a)});function c(u){switch(u){case"string":n.elseIf((0,O._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,O._)`"" + ${o}`).elseIf((0,O._)`${o} === null`).assign(a,(0,O._)`""`);return;case"number":n.elseIf((0,O._)`${i} == "boolean" || ${o} === null
4
+ || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,O._)`+${o}`);return;case"integer":n.elseIf((0,O._)`${i} === "boolean" || ${o} === null
5
+ || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,O._)`+${o}`);return;case"boolean":n.elseIf((0,O._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,O._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,O._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,O._)`${i} === "string" || ${i} === "number"
6
+ || ${i} === "boolean" || ${o} === null`).assign(a,(0,O._)`[${o}]`)}}}function Uv({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,O._)`${e} !== undefined`,()=>t.assign((0,O._)`${e}[${r}]`,n))}function Ii(t,e,r,n=nr.Correct){let o=n===nr.Correct?O.operators.EQ:O.operators.NEQ,s;switch(t){case"null":return(0,O._)`${e} ${o} null`;case"array":s=(0,O._)`Array.isArray(${e})`;break;case"object":s=(0,O._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,O._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,O._)`typeof ${e} ${o} ${t}`}return n===nr.Correct?s:(0,O.not)(s);function i(a=O.nil){return(0,O.and)((0,O._)`typeof ${e} == "number"`,a,r?(0,O._)`isFinite(${e})`:O.nil)}}ye.checkDataType=Ii;function Ci(t,e,r,n){if(t.length===1)return Ii(t[0],e,r,n);let o,s=(0,Xp.toHash)(t);if(s.array&&s.object){let i=(0,O._)`typeof ${e} != "object"`;o=s.null?i:(0,O._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=O.nil;s.number&&delete s.integer;for(let i in s)o=(0,O.and)(o,Ii(i,e,r,n));return o}ye.checkDataTypes=Ci;var Fv={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,O._)`{type: ${t}}`:(0,O._)`{type: ${e}}`};function ji(t){let e=Vv(t);(0,Zv.reportError)(e,Fv)}ye.reportTypeError=ji;function Vv(t){let{gen:e,data:r,schema:n}=t,o=(0,Xp.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var rf=v(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.assignDefaults=void 0;var or=R(),Bv=M();function Jv(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)tf(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>tf(t,s,o.default))}go.assignDefaults=Jv;function tf(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,or._)`${s}${(0,or.getProperty)(e)}`;if(o){(0,Bv.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,or._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,or._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,or._)`${a} = ${(0,or.stringify)(r)}`)}});var Ze=v(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.validateUnion=B.validateArray=B.usePattern=B.callValidateCode=B.schemaProperties=B.allSchemaProperties=B.noPropertyInData=B.propertyInData=B.isOwnProperty=B.hasPropFunc=B.reportMissingProp=B.checkMissingProp=B.checkReportMissingProp=void 0;var Y=R(),Zi=M(),_t=st(),Hv=M();function Gv(t,e){let{gen:r,data:n,it:o}=t;r.if(Mi(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Y._)`${e}`},!0),t.error()})}B.checkReportMissingProp=Gv;function Kv({gen:t,data:e,it:{opts:r}},n,o){return(0,Y.or)(...n.map(s=>(0,Y.and)(Mi(t,e,s,r.ownProperties),(0,Y._)`${o} = ${s}`)))}B.checkMissingProp=Kv;function Wv(t,e){t.setParams({missingProperty:e},!0),t.error()}B.reportMissingProp=Wv;function nf(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Y._)`Object.prototype.hasOwnProperty`})}B.hasPropFunc=nf;function qi(t,e,r){return(0,Y._)`${nf(t)}.call(${e}, ${r})`}B.isOwnProperty=qi;function Yv(t,e,r,n){let o=(0,Y._)`${e}${(0,Y.getProperty)(r)} !== undefined`;return n?(0,Y._)`${o} && ${qi(t,e,r)}`:o}B.propertyInData=Yv;function Mi(t,e,r,n){let o=(0,Y._)`${e}${(0,Y.getProperty)(r)} === undefined`;return n?(0,Y.or)(o,(0,Y.not)(qi(t,e,r))):o}B.noPropertyInData=Mi;function of(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}B.allSchemaProperties=of;function Xv(t,e){return of(e).filter(r=>!(0,Zi.alwaysValidSchema)(t,e[r]))}B.schemaProperties=Xv;function Qv({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,Y._)`${t}, ${e}, ${n}${o}`:e,d=[[_t.default.instancePath,(0,Y.strConcat)(_t.default.instancePath,s)],[_t.default.parentData,i.parentData],[_t.default.parentDataProperty,i.parentDataProperty],[_t.default.rootData,_t.default.rootData]];i.opts.dynamicRef&&d.push([_t.default.dynamicAnchors,_t.default.dynamicAnchors]);let p=(0,Y._)`${l}, ${r.object(...d)}`;return c!==Y.nil?(0,Y._)`${a}.call(${c}, ${p})`:(0,Y._)`${a}(${p})`}B.callValidateCode=Qv;var e0=(0,Y._)`new RegExp`;function t0({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Y._)`${o.code==="new RegExp"?e0:(0,Hv.useFunc)(t,o)}(${r}, ${n})`})}B.usePattern=t0;function r0(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,Y._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Zi.Type.Num},s),e.if((0,Y.not)(s),a)})}}B.validateArray=r0;function n0(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Zi.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,Y._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,Y.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}B.validateUnion=n0});var cf=v(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.validateKeywordUsage=Ge.validSchemaType=Ge.funcKeywordCode=Ge.macroKeywordCode=void 0;var we=R(),Ot=st(),o0=Ze(),s0=en();function i0(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=af(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:we.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ge.macroKeywordCode=i0;function a0(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;u0(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=af(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)y(),e.modifying&&sf(t),g(()=>t.error());else{let b=e.async?f():m();e.modifying&&sf(t),g(()=>c0(t,b))}}function f(){let b=n.let("ruleErrs",null);return n.try(()=>y((0,we._)`await `),w=>n.assign(d,!1).if((0,we._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,we._)`${w}.errors`),()=>n.throw(w))),b}function m(){let b=(0,we._)`${l}.errors`;return n.assign(b,null),y(we.nil),b}function y(b=e.async?(0,we._)`await `:we.nil){let w=c.opts.passContext?Ot.default.this:Ot.default.self,$=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,we._)`${b}${(0,o0.callValidateCode)(t,l,w,$)}`,e.modifying)}function g(b){var w;n.if((0,we.not)((w=e.valid)!==null&&w!==void 0?w:d),b)}}Ge.funcKeywordCode=a0;function sf(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,we._)`${n.parentData}[${n.parentDataProperty}]`))}function c0(t,e){let{gen:r}=t;r.if((0,we._)`Array.isArray(${e})`,()=>{r.assign(Ot.default.vErrors,(0,we._)`${Ot.default.vErrors} === null ? ${e} : ${Ot.default.vErrors}.concat(${e})`).assign(Ot.default.errors,(0,we._)`${Ot.default.vErrors}.length`),(0,s0.extendErrors)(t)},()=>t.error())}function u0({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function af(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,we.stringify)(r)})}function l0(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ge.validSchemaType=l0;function d0({schema:t,opts:e,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(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ge.validateKeywordUsage=d0});var lf=v(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.extendSubschemaMode=yt.extendSubschemaData=yt.getSubschema=void 0;var Ke=R(),uf=M();function p0(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ke._)`${t.schemaPath}${(0,Ke.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ke._)`${t.schemaPath}${(0,Ke.getProperty)(e)}${(0,Ke.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,uf.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')}yt.getSubschema=p0;function f0(t,e,{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}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Ke._)`${e.data}${(0,Ke.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Ke.str)`${u}${(0,uf.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ke._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ke.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}yt.extendSubschemaData=f0;function m0(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}yt.extendSubschemaMode=m0});var Li=v((qR,df)=>{"use strict";df.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),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(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var ff=v((MR,pf)=>{"use strict";var bt=pf.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};_o(e,n,o,t,"",t)};bt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};bt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};bt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};bt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _o(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in bt.arrayKeywords)for(var p=0;p<d.length;p++)_o(t,e,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in bt.propsKeywords){if(d&&typeof d=="object")for(var f in d)_o(t,e,r,d[f],o+"/"+l+"/"+h0(f),s,o,l,n,f)}else(l in bt.keywords||t.allKeys&&!(l in bt.skipKeywords))&&_o(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function h0(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var rn=v(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.getSchemaRefs=Pe.resolveUrl=Pe.normalizeId=Pe._getFullPath=Pe.getFullPath=Pe.inlineRef=void 0;var g0=M(),_0=Li(),y0=ff(),b0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function v0(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Di(t):e?mf(t)<=e:!1}Pe.inlineRef=v0;var $0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Di(t){for(let e in t){if($0.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Di)||typeof r=="object"&&Di(r))return!0}return!1}function mf(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!b0.has(r)&&(typeof t[r]=="object"&&(0,g0.eachItem)(t[r],n=>e+=mf(n)),e===1/0))return 1/0}return e}function hf(t,e="",r){r!==!1&&(e=sr(e));let n=t.parse(e);return gf(t,n)}Pe.getFullPath=hf;function gf(t,e){return t.serialize(e).split("#")[0]+"#"}Pe._getFullPath=gf;var w0=/#\/?$/;function sr(t){return t?t.replace(w0,""):""}Pe.normalizeId=sr;function x0(t,e,r){return r=sr(r),t.resolve(e,r)}Pe.resolveUrl=x0;var S0=/^[a-z_][-a-z0-9._]*$/i;function z0(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=sr(t[r]||e),s={"":o},i=hf(n,o,!1),a={},c=new Set;return y0(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let y=i+p,g=s[m];typeof d[r]=="string"&&(g=b.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=g;function b($){let S=this.opts.uriResolver.resolve;if($=sr(g?S(g,$):$),c.has($))throw l($);c.add($);let z=this.refs[$];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?u(d,z.schema,$):$!==sr(y)&&($[0]==="#"?(u(d,a[$],$),a[$]=d):this.refs[$]=y),$}function w($){if(typeof $=="string"){if(!S0.test($))throw new Error(`invalid anchor "${$}"`);b.call(this,`#${$}`)}}}),a;function u(d,p,f){if(p!==void 0&&!_0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Pe.getSchemaRefs=z0});var sn=v(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.getData=vt.KeywordCxt=vt.validateFunctionCode=void 0;var $f=Kp(),_f=tn(),Fi=Ai(),yo=tn(),k0=rf(),on=cf(),Ui=lf(),P=R(),T=st(),P0=rn(),it=M(),nn=en();function E0(t){if(Sf(t)&&(zf(t),xf(t))){O0(t);return}wf(t,()=>(0,$f.topBoolOrEmptySchema)(t))}vt.validateFunctionCode=E0;function wf({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,P._)`${T.default.data}, ${T.default.valCxt}`,n.$async,()=>{t.code((0,P._)`"use strict"; ${yf(r,o)}`),N0(t,o),t.code(s)}):t.func(e,(0,P._)`${T.default.data}, ${T0(o)}`,n.$async,()=>t.code(yf(r,o)).code(s))}function T0(t){return(0,P._)`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${t.dynamicRef?(0,P._)`, ${T.default.dynamicAnchors}={}`:P.nil}}={}`}function N0(t,e){t.if(T.default.valCxt,()=>{t.var(T.default.instancePath,(0,P._)`${T.default.valCxt}.${T.default.instancePath}`),t.var(T.default.parentData,(0,P._)`${T.default.valCxt}.${T.default.parentData}`),t.var(T.default.parentDataProperty,(0,P._)`${T.default.valCxt}.${T.default.parentDataProperty}`),t.var(T.default.rootData,(0,P._)`${T.default.valCxt}.${T.default.rootData}`),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,P._)`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{t.var(T.default.instancePath,(0,P._)`""`),t.var(T.default.parentData,(0,P._)`undefined`),t.var(T.default.parentDataProperty,(0,P._)`undefined`),t.var(T.default.rootData,T.default.data),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,P._)`{}`)})}function O0(t){let{schema:e,opts:r,gen:n}=t;wf(t,()=>{r.$comment&&e.$comment&&Pf(t),j0(t),n.let(T.default.vErrors,null),n.let(T.default.errors,0),r.unevaluated&&R0(t),kf(t),M0(t)})}function R0(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,P._)`${r}.evaluated`),e.if((0,P._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,P._)`${t.evaluated}.props`,(0,P._)`undefined`)),e.if((0,P._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,P._)`${t.evaluated}.items`,(0,P._)`undefined`))}function yf(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,P._)`/*# sourceURL=${r} */`:P.nil}function A0(t,e){if(Sf(t)&&(zf(t),xf(t))){I0(t,e);return}(0,$f.boolOrEmptySchema)(t,e)}function xf({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Sf(t){return typeof t.schema!="boolean"}function I0(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&Pf(t),Z0(t),q0(t);let s=n.const("_errs",T.default.errors);kf(t,s),n.var(e,(0,P._)`${s} === ${T.default.errors}`)}function zf(t){(0,it.checkUnknownRules)(t),C0(t)}function kf(t,e){if(t.opts.jtd)return bf(t,[],!1,e);let r=(0,_f.getSchemaTypes)(t.schema),n=(0,_f.coerceAndCheckDataType)(t,r);bf(t,r,!n,e)}function C0(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,it.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function j0(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,it.checkStrictMode)(t,"default is ignored in the schema root")}function Z0(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,P0.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function q0(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Pf({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,P._)`${T.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,P.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,P._)`${T.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function M0(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,P._)`${T.default.errors} === 0`,()=>e.return(T.default.data),()=>e.throw((0,P._)`new ${o}(${T.default.vErrors})`)):(e.assign((0,P._)`${n}.errors`,T.default.vErrors),s.unevaluated&&L0(t),e.return((0,P._)`${T.default.errors} === 0`))}function L0({gen:t,evaluated:e,props:r,items:n}){r instanceof P.Name&&t.assign((0,P._)`${e}.props`,r),n instanceof P.Name&&t.assign((0,P._)`${e}.items`,n)}function bf(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,it.schemaHasRulesButRef)(s,l))){o.block(()=>Tf(t,"$ref",l.all.$ref.definition));return}c.jtd||D0(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Fi.shouldUseGroup)(s,p)&&(p.type?(o.if((0,yo.checkDataType)(p.type,i,c.strictNumbers)),vf(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,yo.reportTypeError)(t)),o.endIf()):vf(t,p),a||o.if((0,P._)`${T.default.errors} === ${n||0}`))}}function vf(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,k0.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Fi.shouldUseRule)(n,s)&&Tf(t,s.keyword,s.definition,e.type)})}function D0(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(U0(t,e),t.opts.allowUnionTypes||F0(t,e),V0(t,t.dataTypes))}function U0(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Ef(t.dataTypes,r)||Vi(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),J0(t,e)}}function F0(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Vi(t,"use allowUnionTypes to allow union type keyword")}function V0(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Fi.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>B0(e,i))&&Vi(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function B0(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Ef(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function J0(t,e){let r=[];for(let n of t.dataTypes)Ef(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Vi(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,it.checkStrictMode)(t,e,t.opts.strictTypes)}var bo=class{constructor(e,r,n){if((0,on.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,it.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Nf(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,on.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",T.default.errors))}result(e,r,n){this.failResult((0,P.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,P.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,P._)`${r} !== undefined && (${(0,P.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?nn.reportExtraError:nn.reportError)(this,this.def.error,r)}$dataError(){(0,nn.reportError)(this,this.def.$dataError||nn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,nn.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=P.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=P.nil,r=P.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,P.or)((0,P._)`${o} === undefined`,r)),e!==P.nil&&n.assign(e,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==P.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,P.or)(i(),a());function i(){if(n.length){if(!(r instanceof P.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,P._)`${(0,yo.checkDataTypes)(c,r,s.opts.strictNumbers,yo.DataType.Wrong)}`}return P.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,P._)`!${c}(${r})`}return P.nil}}subschema(e,r){let n=(0,Ui.getSubschema)(this.it,e);(0,Ui.extendSubschemaData)(n,this.it,e),(0,Ui.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return A0(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=it.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=it.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,P.Name)),!0}};vt.KeywordCxt=bo;function Tf(t,e,r,n){let o=new bo(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,on.funcKeywordCode)(o,r):"macro"in r?(0,on.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,on.funcKeywordCode)(o,r)}var H0=/^\/(?:[^~]|~0|~1)*$/,G0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Nf(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return T.default.rootData;if(t[0]==="/"){if(!H0.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=T.default.rootData}else{let u=G0.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,P._)`${s}${(0,P.getProperty)((0,it.unescapeJsonPointer)(u))}`,i=(0,P._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}vt.getData=Nf});var vo=v(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var Bi=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ji.default=Bi});var an=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});var Hi=rn(),Gi=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Hi.resolveUrl)(e,r,n),this.missingSchema=(0,Hi.normalizeId)((0,Hi.getFullPath)(e,this.missingRef))}};Ki.default=Gi});var wo=v(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.resolveSchema=qe.getCompilingSchema=qe.resolveRef=qe.compileSchema=qe.SchemaEnv=void 0;var Ue=R(),K0=vo(),Rt=st(),Fe=rn(),Of=M(),W0=sn(),ir=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Fe.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};qe.SchemaEnv=ir;function Yi(t){let e=Rf.call(this,t);if(e)return e;let r=(0,Fe.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Ue.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:K0.default,code:(0,Ue._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Rt.default.data,parentData:Rt.default.parentData,parentDataProperty:Rt.default.parentDataProperty,dataNames:[Rt.default.data],dataPathArr:[Ue.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ue.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ue.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ue._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,W0.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Rt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Rt.default.self}`,`${Rt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:y}=u;f.evaluated={props:m instanceof Ue.Name?void 0:m,items:y instanceof Ue.Name?void 0:y,dynamicProps:m instanceof Ue.Name,dynamicItems:y instanceof Ue.Name},f.source&&(f.source.evaluated=(0,Ue.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}qe.compileSchema=Yi;function Y0(t,e,r){var n;r=(0,Fe.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=e$.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new ir({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=X0.call(this,s)}qe.resolveRef=Y0;function X0(t){return(0,Fe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Yi.call(this,t)}function Rf(t){for(let e of this._compilations)if(Q0(e,t))return e}qe.getCompilingSchema=Rf;function Q0(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function e$(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||$o.call(this,t,e)}function $o(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Fe._getFullPath)(this.opts.uriResolver,r),o=(0,Fe.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Wi.call(this,r,t);let s=(0,Fe.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=$o.call(this,t,i);return typeof a?.schema!="object"?void 0:Wi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Yi.call(this,i),s===(0,Fe.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Fe.resolveUrl)(this.opts.uriResolver,o,u)),new ir({schema:a,schemaId:c,root:t,baseId:o})}return Wi.call(this,r,i)}}qe.resolveSchema=$o;var t$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Wi(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Of.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!t$.has(a)&&u&&(e=(0,Fe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Of.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Fe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=$o.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new ir({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var Af=v((BR,r$)=>{r$.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 ea=v((JR,Mf)=>{"use strict";var n$=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Cf=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),Xi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),jf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o$=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Qi(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var s$=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function If(t){return t.length=0,!0}function i$(t,e,r){if(t.length){let n=Qi(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function a$(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=i$;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=If}else{o.push(u);continue}}return o.length&&(a===If?r.zone=o.join(""):i?n.push(o.join("")):n.push(Qi(o))),r.address=n.join(""),r}function Zf(t){if(c$(t,":")<2)return{host:t,isIPV6:!1};let e=a$(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function c$(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function u$(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var l$={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},d$=/[@/?#:]/g,p$=/[@/?#]/g;function qf(t,e){let r=e?p$:d$;return r.lastIndex=0,t.replace(r,n=>l$[n])}function f$(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let o=t.slice(n+1,n+3);if(Xi(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&jf(i)?r+=i:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function m$(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Xi(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));s!=="."&&jf(s)?e+=s:e+="%"+o,r+=2;continue}}o$(t[r])?e+=t[r]:e+=escape(t[r])}return e}function h$(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Xi(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function g$(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Cf(r)){let n=Zf(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=qf(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Mf.exports={nonSimpleDomain:s$,recomposeAuthority:g$,reescapeHostDelimiters:qf,normalizePercentEncoding:f$,normalizePathEncoding:m$,escapePreservingEscapes:h$,removeDotSegments:u$,isIPv4:Cf,isUUID:n$,normalizeIPv6:Zf,stringArrayToHexStripped:Qi}});var Vf=v((HR,Ff)=>{"use strict";var{isUUID:_$}=ea(),y$=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,b$=["http","https","ws","wss","urn","urn:uuid"];function v$(t){return b$.indexOf(t)!==-1}function ta(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Lf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Df(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function $$(t){return t.secure=ta(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function w$(t){if((t.port===(ta(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function x$(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(y$);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=ra(o);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function S$(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=ra(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function z$(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!_$(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function k$(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Uf={scheme:"http",domainHost:!0,parse:Lf,serialize:Df},P$={scheme:"https",domainHost:Uf.domainHost,parse:Lf,serialize:Df},xo={scheme:"ws",domainHost:!0,parse:$$,serialize:w$},E$={scheme:"wss",domainHost:xo.domainHost,parse:xo.parse,serialize:xo.serialize},T$={scheme:"urn",parse:x$,serialize:S$,skipNormalize:!0},N$={scheme:"urn:uuid",parse:z$,serialize:k$,skipNormalize:!0},So={http:Uf,https:P$,ws:xo,wss:E$,urn:T$,"urn:uuid":N$};Object.setPrototypeOf(So,null);function ra(t){return t&&(So[t]||So[t.toLowerCase()])||void 0}Ff.exports={wsIsSecure:ta,SCHEMES:So,isValidSchemeName:v$,getSchemeHandler:ra}});var Wf=v((GR,zo)=>{"use strict";var{normalizeIPv6:O$,removeDotSegments:cn,recomposeAuthority:R$,normalizePercentEncoding:A$,normalizePathEncoding:I$,escapePreservingEscapes:C$,reescapeHostDelimiters:j$,isIPv4:Z$,nonSimpleDomain:q$}=ea(),{SCHEMES:M$,getSchemeHandler:Jf}=Vf();function L$(t,e){return typeof t=="string"?t=B$(t,e):typeof t=="object"&&(t=ar(At(t,e),e)),t}function D$(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Hf(ar(t,n),ar(e,n),n,!0);return n.skipEscape=!0,At(o,n)}function Hf(t,e,r,n){let o={};return n||(t=ar(At(t,r),r),e=ar(At(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=cn(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=cn(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=cn(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=cn(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function U$(t,e,r){let n=Bf(t,r),o=Bf(e,r);return n!==void 0&&o!==void 0&&n.toLowerCase()===o.toLowerCase()}function At(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],s=Jf(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=A$(r.path):(r.path=C$(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=R$(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=cn(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var F$=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function V$(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Gf(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(F$);if(i){n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]);let a=V$(n,i);if(a!==void 0&&(n.error=n.error||a,o=!0),n.host)if(Z$(n.host)===!1){let l=O$(n.host);n.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=Jf(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&q$(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(u){n.error=n.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=j$(unescape(n.host),s))),n.path&&(n.path=I$(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function ar(t,e){return Gf(t,e).parsed}function B$(t,e){return Kf(t,e).normalized}function Kf(t,e){let{parsed:r,malformedAuthorityOrPort:n}=Gf(t,e);return{normalized:n?t:At(r,e),malformedAuthorityOrPort:n}}function Bf(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Kf(t,e);return n?void 0:r}if(typeof t=="object")return At(t,e)}var na={SCHEMES:M$,normalize:L$,resolve:D$,resolveComponent:Hf,equal:U$,serialize:At,parse:ar};zo.exports=na;zo.exports.default=na;zo.exports.fastUri=na});var Xf=v(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var Yf=Wf();Yf.code='require("ajv/dist/runtime/uri").default';oa.default=Yf});var im=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.CodeGen=me.Name=me.nil=me.stringify=me.str=me._=me.KeywordCxt=void 0;var J$=sn();Object.defineProperty(me,"KeywordCxt",{enumerable:!0,get:function(){return J$.KeywordCxt}});var cr=R();Object.defineProperty(me,"_",{enumerable:!0,get:function(){return cr._}});Object.defineProperty(me,"str",{enumerable:!0,get:function(){return cr.str}});Object.defineProperty(me,"stringify",{enumerable:!0,get:function(){return cr.stringify}});Object.defineProperty(me,"nil",{enumerable:!0,get:function(){return cr.nil}});Object.defineProperty(me,"Name",{enumerable:!0,get:function(){return cr.Name}});Object.defineProperty(me,"CodeGen",{enumerable:!0,get:function(){return cr.CodeGen}});var H$=vo(),nm=an(),G$=Ri(),un=wo(),K$=R(),ln=rn(),ko=tn(),ia=M(),Qf=Af(),W$=Xf(),om=(t,e)=>new RegExp(t,e);om.code="new RegExp";var Y$=["removeAdditional","useDefaults","coerceTypes"],X$=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Q$={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."},ew={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},em=200;function tw(t){var e,r,n,o,s,i,a,c,u,l,d,p,f,m,y,g,b,w,$,S,z,V,ie,at,Lt;let yr=t.strict,Xo=(e=t.code)===null||e===void 0?void 0:e.optimize,gc=Xo===!0||Xo===void 0?1:Xo||0,_c=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:om,yg=(o=t.uriResolver)!==null&&o!==void 0?o:W$.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:yr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:yr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:yr)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:yr)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:yr)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:gc,regExp:_c}:{optimize:gc,regExp:_c},loopRequired:(y=t.loopRequired)!==null&&y!==void 0?y:em,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:em,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:($=t.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(S=t.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(z=t.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(V=t.validateSchema)!==null&&V!==void 0?V:!0,validateFormats:(ie=t.validateFormats)!==null&&ie!==void 0?ie:!0,unicodeRegExp:(at=t.unicodeRegExp)!==null&&at!==void 0?at:!0,int32range:(Lt=t.int32range)!==null&&Lt!==void 0?Lt:!0,uriResolver:yg}}var dn=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...tw(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new K$.ValueScope({scope:{},prefixes:X$,es5:r,lines:n}),this.logger=aw(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,G$.getRules)(),tm.call(this,Q$,e,"NOT SUPPORTED"),tm.call(this,ew,e,"DEPRECATED","warn"),this._metaOpts=sw.call(this),e.formats&&nw.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&ow.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),rw.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Qf;n==="id"&&(o={...Qf},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,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 nm.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(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,ln.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);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(e){let r;for(;typeof(r=rm.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new un.SchemaEnv({schema:{},schemaId:n});if(r=un.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=rm.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,ln.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(uw.call(this,n,r),!r)return(0,ia.eachItem)(n,s=>sa.call(this,s)),this;dw.call(this,r);let o={...r,type:(0,ko.getJSONTypes)(r.type),schemaType:(0,ko.getJSONTypes)(r.schemaType)};return(0,ia.eachItem)(n,o.type.length===0?s=>sa.call(this,s,o):s=>o.type.forEach(i=>sa.call(this,s,o,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;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]=sm(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,ln.normalizeId)(i||n);let u=ln.getSchemaRefs.call(this,e,n);return c=new un.SchemaEnv({schema:e,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(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):un.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{un.compileSchema.call(this,e)}finally{this.opts=r}}};dn.ValidationError=H$.default;dn.MissingRefError=nm.default;me.default=dn;function tm(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function rm(t){return t=(0,ln.normalizeId)(t),this.schemas[t]||this.refs[t]}function rw(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function nw(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function ow(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function sw(){let t={...this.opts};for(let e of Y$)delete t[e];return t}var iw={log(){},warn(){},error(){}};function aw(t){if(t===!1)return iw;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var cw=/^[a-z_$][a-z0-9_$:-]*$/i;function uw(t,e){let{RULES:r}=this;if((0,ia.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!cw.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function sa(t,e,r){var n;let o=e?.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[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,ko.getJSONTypes)(e.type),schemaType:(0,ko.getJSONTypes)(e.schemaType)}};e.before?lw.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function lw(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function dw(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=sm(e)),t.validateSchema=this.compile(e,!0))}var pw={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function sm(t){return{anyOf:[t,pw]}}});var am=v(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var fw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};aa.default=fw});var dm=v(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.callRef=It.getValidate=void 0;var mw=an(),cm=Ze(),Ee=R(),ur=st(),um=wo(),Po=M(),hw={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=um.resolveRef.call(c,u,o,r);if(l===void 0)throw new mw.default(n.opts.uriResolver,o,r);if(l instanceof um.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Eo(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return Eo(t,(0,Ee._)`${m}.validate`,u,u.$async)}function p(m){let y=lm(t,m);Eo(t,y,m,m.$async)}function f(m){let y=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Ee.stringify)(m)}:{ref:m}),g=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:Ee.nil,topSchemaRef:y,errSchemaPath:r},g);t.mergeEvaluated(b),t.ok(g)}}};function lm(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ee._)`${r.scopeValue("wrapper",{ref:e})}.validate`}It.getValidate=lm;function Eo(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?ur.default.this:Ee.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,Ee._)`await ${(0,cm.callValidateCode)(t,e,u)}`),f(e),i||o.assign(m,!0)},y=>{o.if((0,Ee._)`!(${y} instanceof ${s.ValidationError})`,()=>o.throw(y)),p(y),i||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,cm.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let y=(0,Ee._)`${m}.errors`;o.assign(ur.default.vErrors,(0,Ee._)`${ur.default.vErrors} === null ? ${y} : ${ur.default.vErrors}.concat(${y})`),o.assign(ur.default.errors,(0,Ee._)`${ur.default.vErrors}.length`)}function f(m){var y;if(!s.opts.unevaluated)return;let g=(y=r?.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=Po.mergeEvaluated.props(o,g.props,s.props));else{let b=o.var("props",(0,Ee._)`${m}.evaluated.props`);s.props=Po.mergeEvaluated.props(o,b,s.props,Ee.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=Po.mergeEvaluated.items(o,g.items,s.items));else{let b=o.var("items",(0,Ee._)`${m}.evaluated.items`);s.items=Po.mergeEvaluated.items(o,b,s.items,Ee.Name)}}}It.callRef=Eo;It.default=hw});var pm=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var gw=am(),_w=dm(),yw=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",gw.default,_w.default];ca.default=yw});var fm=v(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var To=R(),$t=To.operators,No={maximum:{okStr:"<=",ok:$t.LTE,fail:$t.GT},minimum:{okStr:">=",ok:$t.GTE,fail:$t.LT},exclusiveMaximum:{okStr:"<",ok:$t.LT,fail:$t.GTE},exclusiveMinimum:{okStr:">",ok:$t.GT,fail:$t.LTE}},bw={message:({keyword:t,schemaCode:e})=>(0,To.str)`must be ${No[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,To._)`{comparison: ${No[t].okStr}, limit: ${e}}`},vw={keyword:Object.keys(No),type:"number",schemaType:"number",$data:!0,error:bw,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,To._)`${r} ${No[e].fail} ${n} || isNaN(${r})`)}};ua.default=vw});var mm=v(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});var pn=R(),$w={message:({schemaCode:t})=>(0,pn.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,pn._)`{multipleOf: ${t}}`},ww={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:$w,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,pn._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,pn._)`${i} !== parseInt(${i})`;t.fail$data((0,pn._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};la.default=ww});var gm=v(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});function hm(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}da.default=hm;hm.code='require("ajv/dist/runtime/ucs2length").default'});var _m=v(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var Ct=R(),xw=M(),Sw=gm(),zw={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ct.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ct._)`{limit: ${t}}`},kw={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zw,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Ct.operators.GT:Ct.operators.LT,i=o.opts.unicode===!1?(0,Ct._)`${r}.length`:(0,Ct._)`${(0,xw.useFunc)(t.gen,Sw.default)}(${r})`;t.fail$data((0,Ct._)`${i} ${s} ${n}`)}};pa.default=kw});var ym=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var Pw=Ze(),Ew=M(),lr=R(),Tw={message:({schemaCode:t})=>(0,lr.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,lr._)`{pattern: ${t}}`},Nw={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Tw,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,lr._)`new RegExp`:(0,Ew.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,lr._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,lr._)`!${l}`)}else{let c=(0,Pw.usePattern)(t,o);t.fail$data((0,lr._)`!${c}.test(${r})`)}}};fa.default=Nw});var bm=v(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var fn=R(),Ow={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,fn.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,fn._)`{limit: ${t}}`},Rw={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ow,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?fn.operators.GT:fn.operators.LT;t.fail$data((0,fn._)`Object.keys(${r}).length ${o} ${n}`)}};ma.default=Rw});var vm=v(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var mn=Ze(),hn=R(),Aw=M(),Iw={message:({params:{missingProperty:t}})=>(0,hn.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,hn._)`{missingProperty: ${t}}`},Cw={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Iw,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let y of r)if(f?.[y]===void 0&&!m.has(y)){let g=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${y}" is not defined at "${g}" (strictRequired)`;(0,Aw.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(hn.nil,d);else for(let f of r)(0,mn.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,mn.checkMissingProp)(t,r,f)),(0,mn.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,mn.noPropertyInData)(e,o,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(m,(0,mn.propertyInData)(e,o,f,a.ownProperties)),e.if((0,hn.not)(m),()=>{t.error(),e.break()})},hn.nil)}}};ha.default=Cw});var $m=v(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var gn=R(),jw={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,gn.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,gn._)`{limit: ${t}}`},Zw={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:jw,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?gn.operators.GT:gn.operators.LT;t.fail$data((0,gn._)`${r}.length ${o} ${n}`)}};ga.default=Zw});var Oo=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var wm=Li();wm.code='require("ajv/dist/runtime/equal").default';_a.default=wm});var xm=v(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var ya=tn(),he=R(),qw=M(),Mw=Oo(),Lw={message:({params:{i:t,j:e}})=>(0,he.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,he._)`{i: ${t}, j: ${e}}`},Dw={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Lw,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,ya.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,he._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,he._)`${r}.length`),y=e.let("j");t.setParams({i:m,j:y}),e.assign(c,!0),e.if((0,he._)`${m} > 1`,()=>(d()?p:f)(m,y))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,y){let g=e.name("item"),b=(0,ya.checkDataTypes)(u,g,a.opts.strictNumbers,ya.DataType.Wrong),w=e.const("indices",(0,he._)`{}`);e.for((0,he._)`;${m}--;`,()=>{e.let(g,(0,he._)`${r}[${m}]`),e.if(b,(0,he._)`continue`),u.length>1&&e.if((0,he._)`typeof ${g} == "string"`,(0,he._)`${g} += "_"`),e.if((0,he._)`typeof ${w}[${g}] == "number"`,()=>{e.assign(y,(0,he._)`${w}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,he._)`${w}[${g}] = ${m}`)})}function f(m,y){let g=(0,qw.useFunc)(e,Mw.default),b=e.name("outer");e.label(b).for((0,he._)`;${m}--;`,()=>e.for((0,he._)`${y} = ${m}; ${y}--;`,()=>e.if((0,he._)`${g}(${r}[${m}], ${r}[${y}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};ba.default=Dw});var Sm=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var va=R(),Uw=M(),Fw=Oo(),Vw={message:"must be equal to constant",params:({schemaCode:t})=>(0,va._)`{allowedValue: ${t}}`},Bw={keyword:"const",$data:!0,error:Vw,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,va._)`!${(0,Uw.useFunc)(e,Fw.default)}(${r}, ${o})`):t.fail((0,va._)`${s} !== ${r}`)}};$a.default=Bw});var zm=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var _n=R(),Jw=M(),Hw=Oo(),Gw={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,_n._)`{allowedValues: ${t}}`},Kw={keyword:"enum",schemaType:"array",$data:!0,error:Gw,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;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,Jw.useFunc)(e,Hw.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,_n.or)(...o.map((m,y)=>p(f,y)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,_n._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let y=o[m];return typeof y=="object"&&y!==null?(0,_n._)`${u()}(${r}, ${f}[${m}])`:(0,_n._)`${r} === ${y}`}}};wa.default=Kw});var km=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var Ww=fm(),Yw=mm(),Xw=_m(),Qw=ym(),ex=bm(),tx=vm(),rx=$m(),nx=xm(),ox=Sm(),sx=zm(),ix=[Ww.default,Yw.default,Xw.default,Qw.default,ex.default,tx.default,rx.default,nx.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},ox.default,sx.default];xa.default=ix});var za=v(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.validateAdditionalItems=void 0;var jt=R(),Sa=M(),ax={message:({params:{len:t}})=>(0,jt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,jt._)`{limit: ${t}}`},cx={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ax,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Sa.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Pm(t,n)}};function Pm(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,jt._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,jt._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Sa.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,jt._)`${a} <= ${e.length}`);r.if((0,jt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Sa.Type.Num},u),i.allErrors||r.if((0,jt.not)(u),()=>r.break())})}}yn.validateAdditionalItems=Pm;yn.default=cx});var ka=v(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.validateTuple=void 0;var Em=R(),Ro=M(),ux=Ze(),lx={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Tm(t,"additionalItems",e);r.items=!0,!(0,Ro.alwaysValidSchema)(r,e)&&t.ok((0,ux.validateArray)(t))}};function Tm(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ro.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Em._)`${s}.length`);r.forEach((d,p)=>{(0,Ro.alwaysValidSchema)(a,d)||(n.if((0,Em._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,y=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!y){let g=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Ro.checkStrictMode)(a,g,p.strictTuples)}}}bn.validateTuple=Tm;bn.default=lx});var Nm=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var dx=ka(),px={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,dx.validateTuple)(t,"items")};Pa.default=px});var Rm=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var Om=R(),fx=M(),mx=Ze(),hx=za(),gx={message:({params:{len:t}})=>(0,Om.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Om._)`{limit: ${t}}`},_x={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:gx,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,fx.alwaysValidSchema)(n,e)&&(o?(0,hx.validateAdditionalItems)(t,o):t.ok((0,mx.validateArray)(t)))}};Ea.default=_x});var Am=v(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var Me=R(),Ao=M(),yx={message:({params:{min:t,max:e}})=>e===void 0?(0,Me.str)`must contain at least ${t} valid item(s)`:(0,Me.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Me._)`{minContains: ${t}}`:(0,Me._)`{minContains: ${t}, maxContains: ${e}}`},bx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yx,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,Me._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Ao.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Ao.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ao.alwaysValidSchema)(s,r)){let y=(0,Me._)`${l} >= ${i}`;a!==void 0&&(y=(0,Me._)`${y} && ${l} <= ${a}`),t.pass(y);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,Me._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let y=e.name("_valid"),g=e.let("count",0);f(y,()=>e.if(y,()=>m(g)))}function f(y,g){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:Ao.Type.Num,compositeRule:!0},y),g()})}function m(y){e.code((0,Me._)`${y}++`),a===void 0?e.if((0,Me._)`${y} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,Me._)`${y} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,Me._)`${y} >= ${i}`,()=>e.assign(d,!0)))}}};Ta.default=bx});var jm=v(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.validateSchemaDeps=We.validatePropertyDeps=We.error=void 0;var Na=R(),vx=M(),vn=Ze();We.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Na.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Na._)`{property: ${t},
7
+ missingProperty: ${n},
8
+ depsCount: ${e},
9
+ deps: ${r}}`};var $x={keyword:"dependencies",type:"object",schemaType:"object",error:We.error,code(t){let[e,r]=wx(t);Im(t,e),Cm(t,r)}};function wx({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Im(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,vn.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,vn.checkReportMissingProp)(t,u)}):(r.if((0,Na._)`${c} && (${(0,vn.checkMissingProp)(t,a,s)})`),(0,vn.reportMissingProp)(t,s),r.else())}}We.validatePropertyDeps=Im;function Cm(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,vx.alwaysValidSchema)(s,e[a])||(r.if((0,vn.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}We.validateSchemaDeps=Cm;We.default=$x});var qm=v(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Zm=R(),xx=M(),Sx={message:"property name must be valid",params:({params:t})=>(0,Zm._)`{propertyName: ${t.propertyName}}`},zx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Sx,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,xx.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Zm.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};Oa.default=zx});var Aa=v(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Io=Ze(),Ve=R(),kx=st(),Co=M(),Px={message:"must NOT have additional properties",params:({params:t})=>(0,Ve._)`{additionalProperty: ${t.additionalProperty}}`},Ex={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Px,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Co.alwaysValidSchema)(i,r))return;let u=(0,Io.allSchemaProperties)(n.properties),l=(0,Io.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Ve._)`${s} === ${kx.default.errors}`);function d(){e.forIn("key",o,g=>{!u.length&&!l.length?m(g):e.if(p(g),()=>m(g))})}function p(g){let b;if(u.length>8){let w=(0,Co.schemaRefOrVal)(i,n.properties,"properties");b=(0,Io.isOwnProperty)(e,w,g)}else u.length?b=(0,Ve.or)(...u.map(w=>(0,Ve._)`${g} === ${w}`)):b=Ve.nil;return l.length&&(b=(0,Ve.or)(b,...l.map(w=>(0,Ve._)`${(0,Io.usePattern)(t,w)}.test(${g})`))),(0,Ve.not)(b)}function f(g){e.code((0,Ve._)`delete ${o}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Co.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(y(g,b,!1),e.if((0,Ve.not)(b),()=>{t.reset(),f(g)})):(y(g,b),a||e.if((0,Ve.not)(b),()=>e.break()))}}function y(g,b,w){let $={keyword:"additionalProperties",dataProp:g,dataPropType:Co.Type.Str};w===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema($,b)}}};Ra.default=Ex});var Dm=v(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Tx=sn(),Mm=Ze(),Ia=M(),Lm=Aa(),Nx={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Lm.default.code(new Tx.KeywordCxt(s,Lm.default,"additionalProperties"));let i=(0,Mm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ia.mergeEvaluated.props(e,(0,Ia.toHash)(i),s.props));let a=i.filter(d=>!(0,Ia.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Mm.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Ca.default=Nx});var Bm=v(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Um=Ze(),jo=R(),Fm=M(),Vm=M(),Ox={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,Um.allSchemaProperties)(r),c=a.filter(y=>(0,Fm.alwaysValidSchema)(s,r[y]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof jo.Name)&&(s.props=(0,Vm.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let y of a)u&&f(y),s.allErrors?m(y):(e.var(l,!0),m(y),e.if(l))}function f(y){for(let g in u)new RegExp(y).test(g)&&(0,Fm.checkStrictMode)(s,`property ${g} matches pattern ${y} (use allowMatchingProperties)`)}function m(y){e.forIn("key",n,g=>{e.if((0,jo._)`${(0,Um.usePattern)(t,y)}.test(${g})`,()=>{let b=c.includes(y);b||t.subschema({keyword:"patternProperties",schemaProp:y,dataProp:g,dataPropType:Vm.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,jo._)`${d}[${g}]`,!0):!b&&!s.allErrors&&e.if((0,jo.not)(l),()=>e.break())})})}}};ja.default=Ox});var Jm=v(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var Rx=M(),Ax={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,Rx.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Za.default=Ax});var Hm=v(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Ix=Ze(),Cx={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ix.validateUnion,error:{message:"must match a schema in anyOf"}};qa.default=Cx});var Gm=v(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Zo=R(),jx=M(),Zx={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Zo._)`{passingSchemas: ${t.passing}}`},qx={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Zx,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,jx.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Zo._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Zo._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Zo.Name)})})}}};Ma.default=qx});var Km=v(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var Mx=M(),Lx={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((s,i)=>{if((0,Mx.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};La.default=Lx});var Xm=v(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var qo=R(),Ym=M(),Dx={message:({params:t})=>(0,qo.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,qo._)`{failingKeyword: ${t.ifClause}}`},Ux={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Dx,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Ym.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Wm(n,"then"),s=Wm(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,qo.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,qo._)`${l}`):t.setParams({ifClause:l})}}}};function Wm(t,e){let r=t.schema[e];return r!==void 0&&!(0,Ym.alwaysValidSchema)(t,r)}Da.default=Ux});var Qm=v(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var Fx=M(),Vx={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Fx.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ua.default=Vx});var eh=v(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var Bx=za(),Jx=Nm(),Hx=ka(),Gx=Rm(),Kx=Am(),Wx=jm(),Yx=qm(),Xx=Aa(),Qx=Dm(),eS=Bm(),tS=Jm(),rS=Hm(),nS=Gm(),oS=Km(),sS=Xm(),iS=Qm();function aS(t=!1){let e=[tS.default,rS.default,nS.default,oS.default,sS.default,iS.default,Yx.default,Xx.default,Wx.default,Qx.default,eS.default];return t?e.push(Jx.default,Gx.default):e.push(Bx.default,Hx.default),e.push(Kx.default),e}Fa.default=aS});var th=v(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var oe=R(),cS={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},uS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:cS,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",(0,oe._)`${m}[${i}]`),g=r.let("fType"),b=r.let("format");r.if((0,oe._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(g,(0,oe._)`${y}.type || "string"`).assign(b,(0,oe._)`${y}.validate`),()=>r.assign(g,(0,oe._)`"string"`).assign(b,y)),t.fail$data((0,oe.or)(w(),$()));function w(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${b}`}function $(){let S=l.$async?(0,oe._)`(${y}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,oe._)`${b}(${n})`,z=(0,oe._)`(typeof ${b} == "function" ? ${S} : ${b}.test(${n}))`;return(0,oe._)`${b} && ${b} !== true && ${g} === ${e} && !${z}`}}function f(){let m=d.formats[s];if(!m){w();return}if(m===!0)return;let[y,g,b]=$(m);y===e&&t.pass(S());function w(){if(c.strictSchema===!1){d.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function $(z){let V=z instanceof RegExp?(0,oe.regexpCode)(z):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,ie=r.scopeValue("formats",{key:s,ref:z,code:V});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,oe._)`${ie}.validate`]:["string",z,ie]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${b}(${n})`}return typeof g=="function"?(0,oe._)`${b}(${n})`:(0,oe._)`${b}.test(${n})`}}}};Va.default=uS});var rh=v(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var lS=th(),dS=[lS.default];Ba.default=dS});var nh=v(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.contentVocabulary=dr.metadataVocabulary=void 0;dr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var sh=v(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var pS=pm(),fS=km(),mS=eh(),hS=rh(),oh=nh(),gS=[pS.default,fS.default,(0,mS.default)(),hS.default,oh.metadataVocabulary,oh.contentVocabulary];Ja.default=gS});var ah=v(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.DiscrError=void 0;var ih;(function(t){t.Tag="tag",t.Mapping="mapping"})(ih||(Mo.DiscrError=ih={}))});var uh=v(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var pr=R(),Ha=ah(),ch=wo(),_S=an(),yS=M(),bS={message:({params:{discrError:t,tagName:e}})=>t===Ha.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,pr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},vS={keyword:"discriminator",type:"object",schemaType:"object",error:bS,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{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=e.let("valid",!1),u=e.const("tag",(0,pr._)`${r}${(0,pr.getProperty)(a)}`);e.if((0,pr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ha.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,pr._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Ha.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),y=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(y,pr.Name),m}function p(){var f;let m={},y=b(o),g=!0;for(let S=0;S<i.length;S++){let z=i[S];if(z?.$ref&&!(0,yS.schemaHasRulesButRef)(z,s.self.RULES)){let ie=z.$ref;if(z=ch.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,ie),z instanceof ch.SchemaEnv&&(z=z.schema),z===void 0)throw new _S.default(s.opts.uriResolver,s.baseId,ie)}let V=(f=z?.properties)===null||f===void 0?void 0:f[a];if(typeof V!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(y||b(z)),w(V,S)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function b({required:S}){return Array.isArray(S)&&S.includes(a)}function w(S,z){if(S.const)$(S.const,z);else if(S.enum)for(let V of S.enum)$(V,z);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function $(S,z){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[S]=z}}}};Ga.default=vS});var lh=v((jA,$S)=>{$S.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 Wa=v((X,Ka)=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.MissingRefError=X.ValidationError=X.CodeGen=X.Name=X.nil=X.stringify=X.str=X._=X.KeywordCxt=X.Ajv=void 0;var wS=im(),xS=sh(),SS=uh(),dh=lh(),zS=["/properties"],Lo="http://json-schema.org/draft-07/schema",fr=class extends wS.default{_addVocabularies(){super._addVocabularies(),xS.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(SS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(dh,zS):dh;this.addMetaSchema(e,Lo,!1),this.refs["http://json-schema.org/schema"]=Lo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Lo)?Lo:void 0)}};X.Ajv=fr;Ka.exports=X=fr;Ka.exports.Ajv=fr;Object.defineProperty(X,"__esModule",{value:!0});X.default=fr;var kS=sn();Object.defineProperty(X,"KeywordCxt",{enumerable:!0,get:function(){return kS.KeywordCxt}});var mr=R();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return mr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return mr.str}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return mr.stringify}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return mr.nil}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return mr.Name}});Object.defineProperty(X,"CodeGen",{enumerable:!0,get:function(){return mr.CodeGen}});var PS=vo();Object.defineProperty(X,"ValidationError",{enumerable:!0,get:function(){return PS.default}});var ES=an();Object.defineProperty(X,"MissingRefError",{enumerable:!0,get:function(){return ES.default}})});var bh=v(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.formatNames=Xe.fastFormats=Xe.fullFormats=void 0;function Ye(t,e){return{validate:t,compare:e}}Xe.fullFormats={date:Ye(hh,ec),time:Ye(Xa(!0),tc),"date-time":Ye(ph(!0),_h),"iso-time":Ye(Xa(),gh),"iso-date-time":Ye(ph(),yh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:IS,"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:DS,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:CS,int32:{type:"number",validate:qS},int64:{type:"number",validate:MS},float:{type:"number",validate:mh},double:{type:"number",validate:mh},password:!0,binary:!0};Xe.fastFormats={...Xe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ec),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,tc),"date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,_h),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,gh),"iso-date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,yh),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Xe.formatNames=Object.keys(Xe.fullFormats);function TS(t){return t%4===0&&(t%100!==0||t%400===0)}var NS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,OS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function hh(t){let e=NS.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&TS(r)?29:OS[n])}function ec(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Ya=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Xa(t){return function(r){let n=Ya.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||t&&!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 tc(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function gh(t,e){if(!(t&&e))return;let r=Ya.exec(t),n=Ya.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Qa=/t|\s/i;function ph(t){let e=Xa(t);return function(n){let o=n.split(Qa);return o.length===2&&hh(o[0])&&e(o[1])}}function _h(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function yh(t,e){if(!(t&&e))return;let[r,n]=t.split(Qa),[o,s]=e.split(Qa),i=ec(r,o);if(i!==void 0)return i||tc(n,s)}var RS=/\/|:/,AS=/^(?:[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 IS(t){return RS.test(t)&&AS.test(t)}var fh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function CS(t){return fh.lastIndex=0,fh.test(t)}var jS=-(2**31),ZS=2**31-1;function qS(t){return Number.isInteger(t)&&t<=ZS&&t>=jS}function MS(t){return Number.isInteger(t)}function mh(){return!0}var LS=/[^\\]\\Z/;function DS(t){if(LS.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var vh=v(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.formatLimitDefinition=void 0;var US=Wa(),Be=R(),wt=Be.operators,Do={formatMaximum:{okStr:"<=",ok:wt.LTE,fail:wt.GT},formatMinimum:{okStr:">=",ok:wt.GTE,fail:wt.LT},formatExclusiveMaximum:{okStr:"<",ok:wt.LT,fail:wt.GTE},formatExclusiveMinimum:{okStr:">",ok:wt.GT,fail:wt.LTE}},FS={message:({keyword:t,schemaCode:e})=>(0,Be.str)`should be ${Do[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Be._)`{comparison: ${Do[t].okStr}, limit: ${e}}`};hr.formatLimitDefinition={keyword:Object.keys(Do),type:"string",schemaType:"string",$data:!0,error:FS,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new US.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Be._)`${p}[${c.schemaCode}]`);t.fail$data((0,Be.or)((0,Be._)`typeof ${f} != "object"`,(0,Be._)`${f} instanceof RegExp`,(0,Be._)`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 m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Be._)`${i.code.formats}${(0,Be.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Be._)`${p}.compare(${r}, ${n}) ${Do[o].fail} 0`}},dependencies:["format"]};var VS=t=>(t.addKeyword(hr.formatLimitDefinition),t);hr.default=VS});var Sh=v(($n,xh)=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});var gr=bh(),BS=vh(),rc=R(),$h=new rc.Name("fullFormats"),JS=new rc.Name("fastFormats"),nc=(t,e={keywords:!0})=>{if(Array.isArray(e))return wh(t,e,gr.fullFormats,$h),t;let[r,n]=e.mode==="fast"?[gr.fastFormats,JS]:[gr.fullFormats,$h],o=e.formats||gr.formatNames;return wh(t,o,r,n),e.keywords&&(0,BS.default)(t),t};nc.get=(t,e="full")=>{let n=(e==="fast"?gr.fastFormats:gr.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function wh(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,rc._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}xh.exports=$n=nc;Object.defineProperty($n,"__esModule",{value:!0});$n.default=nc});var wn=v(Je=>{"use strict";var Nh=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",KS=Nh+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Oh="["+Nh+"]["+KS+"]*",WS=new RegExp("^"+Oh+"$"),YS=function(t,e){let r=[],n=e.exec(t);for(;n;){let o=[];o.startIndex=e.lastIndex-n[0].length;let s=n.length;for(let i=0;i<s;i++)o.push(n[i]);r.push(o),n=e.exec(t)}return r},XS=function(t){let e=WS.exec(t);return!(e===null||typeof e>"u")};Je.isExist=function(t){return typeof t<"u"};Je.isEmptyObject=function(t){return Object.keys(t).length===0};Je.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let s=0;s<o;s++)r==="strict"?t[n[s]]=[e[n[s]]]:t[n[s]]=e[n[s]]}};Je.getValue=function(t){return Je.isExist(t)?t:""};var QS=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],ez=["__proto__","constructor","prototype"];Je.isName=XS;Je.getAllMatches=YS;Je.nameRegexp=Oh;Je.DANGEROUS_PROPERTY_NAMES=QS;Je.criticalProperties=ez});var ic=v(jh=>{"use strict";var sc=wn(),tz={allowBooleanAttributes:!1,unpairedTags:[]};jh.validate=function(t,e){e=Object.assign({},tz,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=Ah(t,s),s.err)return s}else if(t[s]==="<"){let i=s;if(s++,t[s]==="!"){s=Ih(t,s);continue}else{let a=!1;t[s]==="/"&&(a=!0,s++);let c="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
10
+ `&&t[s]!=="\r";s++)c+=t[s];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),s--),!uz(c)){let d;return c.trim().length===0?d="Invalid space after '<'.":d="Tag '"+c+"' is an invalid name.",se("InvalidTag",d,xe(t,s))}let u=oz(t,s);if(u===!1)return se("InvalidAttr","Attributes for '"+c+"' have open quote.",xe(t,s));let l=u.value;if(s=u.index,l[l.length-1]==="/"){let d=s-l.length;l=l.substring(0,l.length-1);let p=Ch(l,e);if(p===!0)n=!0;else return se(p.err.code,p.err.msg,xe(t,d+p.err.line))}else if(a)if(u.tagClosed){if(l.trim().length>0)return se("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",xe(t,i));if(r.length===0)return se("InvalidTag","Closing tag '"+c+"' has not been opened.",xe(t,i));{let d=r.pop();if(c!==d.tagName){let p=xe(t,d.tagStartPos);return se("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+c+"'.",xe(t,i))}r.length==0&&(o=!0)}}else return se("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",xe(t,s));else{let d=Ch(l,e);if(d!==!0)return se(d.err.code,d.err.msg,xe(t,s-l.length+d.err.line));if(o===!0)return se("InvalidXml","Multiple possible root nodes found.",xe(t,s));e.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:i}),n=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=Ih(t,s);continue}else if(t[s+1]==="?"){if(s=Ah(t,++s),s.err)return s}else break;else if(t[s]==="&"){let d=az(t,s);if(d==-1)return se("InvalidChar","char '&' is not expected.",xe(t,s));s=d}else if(o===!0&&!Rh(t[s]))return se("InvalidXml","Extra text at the end",xe(t,s));t[s]==="<"&&s--}}else{if(Rh(t[s]))continue;return se("InvalidChar","char '"+t[s]+"' is not expected.",xe(t,s))}if(n){if(r.length==1)return se("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",xe(t,r[0].tagStartPos));if(r.length>0)return se("InvalidXml","Invalid '"+JSON.stringify(r.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return se("InvalidXml","Start tag expected.",1);return!0};function Rh(t){return t===" "||t===" "||t===`
11
+ `||t==="\r"}function Ah(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return se("InvalidXml","XML declaration allowed only at the start of the document.",xe(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Ih(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var rz='"',nz="'";function oz(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===rz||t[e]===nz)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var sz=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Ch(t,e){let r=sc.getAllMatches(t,sz),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return se("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",xn(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return se("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",xn(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return se("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",xn(r[o]));let s=r[o][2];if(!cz(s))return se("InvalidAttr","Attribute '"+s+"' is an invalid name.",xn(r[o]));if(!n.hasOwnProperty(s))n[s]=1;else return se("InvalidAttr","Attribute '"+s+"' is repeated.",xn(r[o]))}return!0}function iz(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function az(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,iz(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function se(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function cz(t){return sc.isName(t)}function uz(t){return sc.isName(t)}function xe(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function xn(t){return t.startIndex+t[1].length}});var Dh=v(ac=>{var{DANGEROUS_PROPERTY_NAMES:Zh,criticalProperties:lz}=wn(),qh=t=>Zh.includes(t)?"__"+t:t,Mh={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,onDangerousProperty:qh};function dz(t,e){if(typeof t!="string")return;let r=t.toLowerCase();if(Zh.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(lz.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Lh(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:Lh(!0)}var pz=function(t){let e=Object.assign({},Mh,t),r=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:n,name:o}of r)n&&dz(n,o);return e.onDangerousProperty===null&&(e.onDangerousProperty=qh),e.processEntities=Lh(e.processEntities),e};ac.buildOptions=pz;ac.defaultOptions=Mh});var Fh=v((nI,Uh)=>{"use strict";var cc=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};Uh.exports=cc});var Jh=v((oI,Bh)=>{var Vh=wn(),uc=class{constructor(e){this.suppressValidationErr=!e,this.options=e||{}}readDocType(e,r){let n=Object.create(null),o=0;if(e[r+3]==="O"&&e[r+4]==="C"&&e[r+5]==="T"&&e[r+6]==="Y"&&e[r+7]==="P"&&e[r+8]==="E"){r=r+9;let s=1,i=!1,a=!1,c="";for(;r<e.length;r++)if(e[r]==="<"&&!a){if(i&&Zt(e,"!ENTITY",r)){r+=7;let u,l;if([u,l,r]=this.readEntityExp(e,r+1,this.suppressValidationErr),l.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&o>=this.options.maxEntityCount)throw new Error(`Entity count (${o+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);let d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n[u]={regx:RegExp(`&${d};`,"g"),val:l},o++}}else if(i&&Zt(e,"!ELEMENT",r)){r+=8;let{index:u}=this.readElementExp(e,r+1);r=u}else if(i&&Zt(e,"!ATTLIST",r))r+=8;else if(i&&Zt(e,"!NOTATION",r)){r+=9;let{index:u}=this.readNotationExp(e,r+1,this.suppressValidationErr);r=u}else if(Zt(e,"!--",r))a=!0;else throw new Error("Invalid DOCTYPE");s++,c=""}else if(e[r]===">"){if(a?e[r-1]==="-"&&e[r-2]==="-"&&(a=!1,s--):s--,s===0)break}else e[r]==="["?i=!0:c+=e[r];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(e,r){r=Te(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r])&&e[r]!=='"'&&e[r]!=="'";)n+=e[r],r++;if(Sn(n),r=Te(e,r),!this.suppressValidationErr){if(e.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[r]==="%")throw new Error("Parameter entities are not supported")}let o="";if([r,o]=this.readIdentifierVal(e,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&o.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[n,o,r]}readNotationExp(e,r){r=Te(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;!this.suppressValidationErr&&Sn(n),r=Te(e,r);let o=e.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);r+=o.length,r=Te(e,r);let s=null,i=null;if(o==="PUBLIC")[r,s]=this.readIdentifierVal(e,r,"publicIdentifier"),r=Te(e,r),(e[r]==='"'||e[r]==="'")&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"));else if(o==="SYSTEM"&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:s,systemIdentifier:i,index:--r}}readIdentifierVal(e,r,n){let o="",s=e[r];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(r++;r<e.length&&e[r]!==s;)o+=e[r],r++;if(e[r]!==s)throw new Error(`Unterminated ${n} value`);return r++,[r,o]}readElementExp(e,r){r=Te(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;if(!this.suppressValidationErr&&!Vh.isName(n))throw new Error(`Invalid element name: "${n}"`);r=Te(e,r);let o="";if(e[r]==="E"&&Zt(e,"MPTY",r))r+=4;else if(e[r]==="A"&&Zt(e,"NY",r))r+=2;else if(e[r]==="("){for(r++;r<e.length&&e[r]!==")";)o+=e[r],r++;if(e[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[r]}"`);return{elementName:n,contentModel:o.trim(),index:r}}readAttlistExp(e,r){r=Te(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;Sn(n),r=Te(e,r);let o="";for(;r<e.length&&!/\s/.test(e[r]);)o+=e[r],r++;if(!Sn(o))throw new Error(`Invalid attribute name: "${o}"`);r=Te(e,r);let s="";if(e.substring(r,r+8).toUpperCase()==="NOTATION"){if(s="NOTATION",r+=8,r=Te(e,r),e[r]!=="(")throw new Error(`Expected '(', found "${e[r]}"`);r++;let a=[];for(;r<e.length&&e[r]!==")";){let c="";for(;r<e.length&&e[r]!=="|"&&e[r]!==")";)c+=e[r],r++;if(c=c.trim(),!Sn(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),e[r]==="|"&&(r++,r=Te(e,r))}if(e[r]!==")")throw new Error("Unterminated list of notations");r++,s+=" ("+a.join("|")+")"}else{for(;r<e.length&&!/\s/.test(e[r]);)s+=e[r],r++;let a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}r=Te(e,r);let i="";return e.substring(r,r+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",r+=8):e.substring(r,r+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",r+=7):[r,i]=this.readIdentifierVal(e,r,"ATTLIST"),{elementName:n,attributeName:o,attributeType:s,defaultValue:i,index:r}}},Te=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function Zt(t,e,r){for(let n=0;n<e.length;n++)if(e[n]!==t[r+n+1])return!1;return!0}function Sn(t){if(Vh.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}Bh.exports=uc});var Gh=v((sI,Hh)=>{var fz=/^[-+]?0x[a-fA-F0-9]+$/,mz=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,hz={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function gz(t,e={}){if(e=Object.assign({},hz,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(t==="0")return 0;if(e.hex&&fz.test(r))return yz(r,16);if(r.search(/[eE]/)!==-1){let n=r.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(n){if(e.leadingZeros)r=(n[1]||"")+n[3];else if(!(n[2]==="0"&&n[3][0]==="."))return t;return e.eNotation?Number(r):t}else return t}else{let n=mz.exec(r);if(n){let o=n[1],s=n[2],i=_z(n[3]);if(!e.leadingZeros&&s.length>0&&o&&r[2]!==".")return t;if(!e.leadingZeros&&s.length>0&&!o&&r[1]!==".")return t;if(e.leadingZeros&&s===t)return 0;{let a=Number(r),c=""+a;return c.search(/[eE]/)!==-1?e.eNotation?a:t:r.indexOf(".")!==-1?c==="0"&&i===""||c===i||o&&c==="-"+i?a:t:s?i===c||o+i===c?a:t:r===c||r===o+c?a:t}}else return t}}function _z(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}function yz(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}Hh.exports=gz});var lc=v((iI,Kh)=>{function bz(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let r of t)if(typeof r=="string"&&e===r||r instanceof RegExp&&r.test(e))return!0}:()=>!1}Kh.exports=bz});var Xh=v((aI,Yh)=>{"use strict";var Ho=wn(),_r=Fh(),vz=Jh(),$z=Gh(),wz=lc(),dc=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>Wh(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>Wh(n,16,"&#x")}},this.addExternalEntities=xz,this.parseXml=Ez,this.parseTextData=Sz,this.resolveNameSpace=zz,this.buildAttributesMap=Pz,this.isItStopNode=Rz,this.replaceEntitiesValue=Nz,this.readStopNodeData=Iz,this.saveTextToParentTag=Oz,this.addChild=Tz,this.ignoreAttributesFn=wz(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let r=0;r<this.options.stopNodes.length;r++){let n=this.options.stopNodes[r];typeof n=="string"&&(n.startsWith("*.")?this.stopNodesWildcard.add(n.substring(2)):this.stopNodesExact.add(n))}}}};function xz(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r],o=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+o+";","g"),val:t[n]}}}function Sz(t,e,r,n,o,s,i){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,r));let a=this.options.tagValueProcessor(e,t,r,o,s);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?fc(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?fc(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function zz(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var kz=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Pz(t,e,r){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){let n=Ho.getAllMatches(t,kz),o=n.length,s={};for(let i=0;i<o;i++){let a=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(a,e))continue;let c=n[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u=Cz(u,this.options),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,r,e);let l=this.options.attributeValueProcessor(a,c,e);l==null?s[u]=c:typeof l!=typeof c||l!==c?s[u]=l:s[u]=fc(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){let i={};return i[this.options.attributesGroupName]=s,i}return s}}var Ez=function(t){t=t.replace(/\r\n?/g,`
12
+ `);let e=new _r("!xml"),r=e,n="",o="";this.entityExpansionCount=0,this.currentExpandedLength=0;let s=new vz(this.options.processEntities);for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let c=qt(t,">",i,"Closing Tag is not closed."),u=t.substring(i+2,c).trim();if(this.options.removeNSPrefix){let p=u.indexOf(":");p!==-1&&(u=u.substr(p+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,o));let l=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let d=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(d=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=o.lastIndexOf("."),o=o.substring(0,d),r=this.tagsNodeStack.pop(),n="",i=c}else if(t[i+1]==="?"){let c=pc(t,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,o),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let u=new _r(c.tagName);u.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(u[":@"]=this.buildAttributesMap(c.tagExp,o,c.tagName)),this.addChild(r,u,o,i)}i=c.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let c=qt(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(i+4,c-2);n=this.saveTextToParentTag(n,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=c}else if(t.substr(i+1,2)==="!D"){let c=s.readDocType(t,i);this.docTypeEntities=c.entities,i=c.i}else if(t.substr(i+1,2)==="!["){let c=qt(t,"]]>",i,"CDATA is not closed.")-2,u=t.substring(i+9,c);n=this.saveTextToParentTag(n,r,o);let l=this.parseTextData(u,r.tagname,o,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),i=c+2}else{let c=pc(t,i,this.options.removeNSPrefix),u=c.tagName,l=c.rawTagName,d=c.tagExp,p=c.attrExpPresent,f=c.closeIndex;if(this.options.transformTagName){let g=this.options.transformTagName(u);d===u&&(d=g),u=g}if(this.options.strictReservedNames&&(u===this.options.commentPropName||u===this.options.cdataPropName||u===this.options.textNodeName||u===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${u}`);r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let m=r;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u);let y=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let g="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),d=u):d=d.substr(0,d.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=c.closeIndex;else{let w=this.readStopNodeData(t,l,f+1);if(!w)throw new Error(`Unexpected end of ${l}`);i=w.i,g=w.tagContent}let b=new _r(u);u!==d&&p&&(b[":@"]=this.buildAttributesMap(d,o,u)),g&&(g=this.parseTextData(g,u,o,!0,p,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),b.add(this.options.textNodeName,g),this.addChild(r,b,o,y)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){if(u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),d=u):d=d.substr(0,d.length-1),this.options.transformTagName){let b=this.options.transformTagName(u);d===u&&(d=b),u=b}let g=new _r(u);u!==d&&p&&(g[":@"]=this.buildAttributesMap(d,o,u)),this.addChild(r,g,o,y),o=o.substr(0,o.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(u)!==-1){let g=new _r(u);u!==d&&p&&(g[":@"]=this.buildAttributesMap(d,o)),this.addChild(r,g,o,y),o=o.substr(0,o.lastIndexOf(".")),i=c.closeIndex;continue}else{let g=new _r(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),u!==d&&p&&(g[":@"]=this.buildAttributesMap(d,o,u)),this.addChild(r,g,o),r=g}n="",i=f}}else n+=t[i];return e.child};function Tz(t,e,r,n){this.options.captureMetaData||(n=void 0);let o=this.options.updateTag(e.tagname,r,e[":@"]);o===!1||(typeof o=="string"&&(e.tagname=o),t.addChild(e,n))}var Nz=function(t,e,r){if(t.indexOf("&")===-1)return t;let n=this.options.processEntities;if(!n.enabled||n.allowedTags&&!n.allowedTags.includes(e)||n.tagFilter&&!n.tagFilter(e,r))return t;for(let o in this.docTypeEntities){let s=this.docTypeEntities[o],i=t.match(s.regx);if(i){if(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);let a=t.length;if(t=t.replace(s.regx,s.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-a,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(let o of Object.keys(this.lastEntities)){let s=this.lastEntities[o],i=t.match(s.regex);if(i&&(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);t=t.replace(s.regex,s.val)}if(t.indexOf("&")===-1)return t;if(this.options.htmlEntities)for(let o of Object.keys(this.htmlEntities)){let s=this.htmlEntities[o],i=t.match(s.regex);if(i&&(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);t=t.replace(s.regex,s.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t};function Oz(t,e,r,n){return t&&(n===void 0&&(n=e.child.length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Rz(t,e,r,n){return!!(e&&e.has(n)||t&&t.has(r))}function Az(t,e,r=">"){let n,o="";for(let s=e;s<t.length;s++){let i=t[s];if(n)i===n&&(n="");else if(i==='"'||i==="'")n=i;else if(i===r[0])if(r[1]){if(t[s+1]===r[1])return{data:o,index:s}}else return{data:o,index:s};else i===" "&&(i=" ");o+=i}}function qt(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function pc(t,e,r,n=">"){let o=Az(t,e+1,n);if(!o)return;let s=o.data,i=o.index,a=s.search(/\s/),c=s,u=!0;a!==-1&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());let l=c;if(r){let d=c.indexOf(":");d!==-1&&(c=c.substr(d+1),u=c!==o.data.substr(d+1))}return{tagName:c,tagExp:s,closeIndex:i,attrExpPresent:u,rawTagName:l}}function Iz(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let s=qt(t,">",r,`${e} is not closed`);if(t.substring(r+2,s).trim()===e&&(o--,o===0))return{tagContent:t.substring(n,r),i:s};r=s}else if(t[r+1]==="?")r=qt(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=qt(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=qt(t,"]]>",r,"StopNode is not closed.")-2;else{let s=pc(t,r,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,r=s.closeIndex)}}function fc(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:$z(t,r)}else return Ho.isExist(t)?t:""}function Wh(t,e,r){let n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):r+t+";"}function Cz(t,e){if(Ho.criticalProperties.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return Ho.DANGEROUS_PROPERTY_NAMES.includes(t)?e.onDangerousProperty(t):t}Yh.exports=dc});var tg=v(eg=>{"use strict";function jz(t,e){return Qh(t,e)}function Qh(t,e,r){let n,o={};for(let s=0;s<t.length;s++){let i=t[s],a=Zz(i),c="";if(r===void 0?c=a:c=r+"."+a,a===e.textNodeName)n===void 0?n=i[a]:n+=""+i[a];else{if(a===void 0)continue;if(i[a]){let u=Qh(i[a],e,c),l=Mz(u,e);i[":@"]?qz(u,i[":@"],c,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),o[a]!==void 0&&o.hasOwnProperty(a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(u)):e.isArray(a,c,l)?o[a]=[u]:o[a]=u}}}return typeof n=="string"?n.length>0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function Zz(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function qz(t,e,r,n){if(e){let o=Object.keys(e),s=o.length;for(let i=0;i<s;i++){let a=o[i];n.isArray(a,r+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function Mz(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}eg.prettify=jz});var ng=v((uI,rg)=>{var{buildOptions:Lz}=Dh(),Dz=Xh(),{prettify:Uz}=tg(),Fz=ic(),mc=class{constructor(e){this.externalEntities={},this.options=Lz(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let s=Fz.validate(e,r);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new Dz(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:Uz(o,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};rg.exports=mc});var ag=v((lI,ig)=>{function Vz(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=`
13
+ `),sg(t,e,"",r)}function sg(t,e,r,n){let o="",s=!1;if(!Array.isArray(t)){if(t!=null){let i=t.toString();return i=hc(i,e),i}return""}for(let i=0;i<t.length;i++){let a=t[i],c=Bz(a);if(c===void 0)continue;let u="";if(r.length===0?u=c:u=`${r}.${c}`,c===e.textNodeName){let m=a[c];Jz(u,e)||(m=e.tagValueProcessor(c,m),m=hc(m,e)),s&&(o+=n),o+=m,s=!1;continue}else if(c===e.cdataPropName){s&&(o+=n),o+=`<![CDATA[${a[c][0][e.textNodeName]}]]>`,s=!1;continue}else if(c===e.commentPropName){o+=n+`<!--${a[c][0][e.textNodeName]}-->`,s=!0;continue}else if(c[0]==="?"){let m=og(a[":@"],e),y=c==="?xml"?"":n,g=a[c][0][e.textNodeName];g=g.length!==0?" "+g:"",o+=y+`<${c}${g}${m}?>`,s=!0;continue}let l=n;l!==""&&(l+=e.indentBy);let d=og(a[":@"],e),p=n+`<${c}${d}`,f=sg(a[c],e,u,l);e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?o+=p+">":o+=p+"/>":(!f||f.length===0)&&e.suppressEmptyNode?o+=p+"/>":f&&f.endsWith(">")?o+=p+`>${f}${n}</${c}>`:(o+=p+">",f&&n!==""&&(f.includes("/>")||f.includes("</"))?o+=n+e.indentBy+f+n:o+=f,o+=`</${c}>`),s=!0}return o}function Bz(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(Object.prototype.hasOwnProperty.call(t,n)&&n!==":@")return n}}function og(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let o=e.attributeValueProcessor(n,t[n]);o=hc(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function Jz(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function hc(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}ig.exports=Vz});var ug=v((dI,cg)=>{"use strict";var Hz=ag(),Gz=lc(),Kz={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function xt(t){this.options=Object.assign({},Kz,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Gz(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Xz),this.processTextOrObjNode=Wz,this.options.format?(this.indentate=Yz,this.tagEndChar=`>
14
+ `,this.newLine=`
15
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}xt.prototype.build=function(t){return this.options.preserveOrder?Hz(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};xt.prototype.j2x=function(t,e,r){let n="",o="",s=r.join(".");for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(typeof t[i]>"u")this.isAttribute(i)&&(o+="");else if(t[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?o+="":i[0]==="?"?o+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)o+=this.buildTextValNode(t[i],i,"",e);else if(typeof t[i]!="object"){let a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,s))n+=this.buildAttrPairStr(a,""+t[i]);else if(!a)if(i===this.options.textNodeName){let c=this.options.tagValueProcessor(i,""+t[i]);o+=this.replaceEntitiesValue(c)}else o+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){let a=t[i].length,c="",u="";for(let l=0;l<a;l++){let d=t[i][l];if(!(typeof d>"u"))if(d===null)i[0]==="?"?o+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(typeof d=="object")if(this.options.oneListGroup){let p=this.j2x(d,e+1,r.concat(i));c+=p.val,this.options.attributesGroupName&&d.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else c+=this.processTextOrObjNode(d,i,e,r);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(i,d);p=this.replaceEntitiesValue(p),c+=p}else c+=this.buildTextValNode(d,i,"",e)}this.options.oneListGroup&&(c=this.buildObjectNode(c,i,u,e)),o+=c}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){let a=Object.keys(t[i]),c=a.length;for(let u=0;u<c;u++)n+=this.buildAttrPairStr(a[u],""+t[i][a[u]])}else o+=this.processTextOrObjNode(t[i],i,e,r);return{attrStr:n,val:o}};xt.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Wz(t,e,r,n){let o=this.j2x(t,r+1,n.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,r):this.buildObjectNode(o.val,e,o.attrStr,r)}xt.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let o="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",o=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+s+">"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+s+this.tagEndChar+t+this.indentate(n)+o}};xt.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};xt.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,t);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"</"+e+this.tagEndChar}};xt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function Yz(t){return this.options.indentBy.repeat(t)}function Xz(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}cg.exports=xt});var dg=v((pI,lg)=>{"use strict";var Qz=ic(),ek=ng(),tk=ug();lg.exports={XMLParser:ek,XMLValidator:Qz,XMLBuilder:tk}});var bc;function _(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].bind(a))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var He=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ut=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(bc=globalThis).__zod_globalConfig??(bc.__zod_globalConfig={});var Ft=globalThis.__zod_globalConfig;function Ne(t){return t&&Object.assign(Ft,t),Ft}var q={};yc(q,{BIGINT_FORMAT_RANGES:()=>xc,Class:()=>ts,NUMBER_FORMAT_RANGES:()=>as,aborted:()=>lt,allowsEval:()=>os,assert:()=>Tg,assertEqual:()=>zg,assertIs:()=>Pg,assertNever:()=>Eg,assertNotEqual:()=>kg,assignProp:()=>ct,base64ToUint8Array:()=>zc,base64urlToUint8Array:()=>Jg,cached:()=>Bt,captureStackTrace:()=>Pn,cleanEnum:()=>Bg,cleanRegex:()=>wr,clone:()=>Le,cloneDef:()=>Og,createTransparentProxy:()=>Zg,defineLazy:()=>U,esc:()=>kn,escapeRegex:()=>et,explicitlyAborted:()=>cs,extend:()=>Lg,finalizeIssue:()=>Ae,floatSafeRemainder:()=>rs,getElementAtPath:()=>Rg,getEnumValues:()=>vr,getLengthableOrigin:()=>xr,getParsedType:()=>jg,getSizableOrigin:()=>Sc,hexToUint8Array:()=>Gg,isObject:()=>St,isPlainObject:()=>ut,issue:()=>Jt,joinValues:()=>zn,jsonStringifyReplacer:()=>Vt,merge:()=>Ug,mergeDefs:()=>Qe,normalizeParams:()=>E,nullish:()=>$r,numKeys:()=>Cg,objectClone:()=>Ng,omit:()=>Mg,optionalKeys:()=>is,parsedType:()=>us,partial:()=>Fg,pick:()=>qg,prefixIssues:()=>tt,primitiveTypes:()=>wc,promiseAllObject:()=>Ag,propertyKeyTypes:()=>ss,randomString:()=>Ig,required:()=>Vg,safeExtend:()=>Dg,shallowClone:()=>$c,slugify:()=>ns,stringifyPrimitive:()=>En,uint8ArrayToBase64:()=>kc,uint8ArrayToBase64url:()=>Hg,uint8ArrayToHex:()=>Kg,unwrapMessage:()=>br});function zg(t){return t}function kg(t){return t}function Pg(t){}function Eg(t){throw new Error("Unexpected value in exhaustive check")}function Tg(t){}function vr(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function zn(t,e="|"){return t.map(r=>En(r)).join(e)}function Vt(t,e){return typeof e=="bigint"?e.toString():e}function Bt(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function $r(t){return t==null}function wr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function rs(t,e){let r=t/e,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var vc=Symbol("evaluating");function U(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==vc)return n===void 0&&(n=vc,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Ng(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ct(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qe(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Og(t){return Qe(t._zod.def)}function Rg(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Ag(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function Ig(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function kn(t){return JSON.stringify(t)}function ns(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Pn="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function St(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var os=Bt(()=>{if(Ft.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function ut(t){if(St(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(St(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function $c(t){return ut(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Cg(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var jg=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ss=new Set(["string","number","symbol"]),wc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function et(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Le(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Zg(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function En(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function is(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var as={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]},xc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function qg(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Qe(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return ct(this,"shape",i),i},checks:[]});return Le(t,s)}function Mg(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Qe(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return ct(this,"shape",i),i},checks:[]});return Le(t,s)}function Lg(t,e){if(!ut(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Qe(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return ct(this,"shape",s),s}});return Le(t,o)}function Dg(t,e){if(!ut(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Qe(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return ct(this,"shape",n),n}});return Le(t,r)}function Ug(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Qe(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ct(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Le(t,r)}function Fg(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=Qe(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return ct(this,"shape",c),c},checks:[]});return Le(e,i)}function Vg(t,e,r){let n=Qe(e._zod.def,{get shape(){let o=e._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:o[i]}))}else for(let i in o)s[i]=new t({type:"nonoptional",innerType:o[i]});return ct(this,"shape",s),s}});return Le(e,n)}function lt(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function cs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function tt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function br(t){return typeof t=="string"?t:t?.message}function Ae(t,e,r){let n=t.message?t.message:br(t.inst?._zod.def?.error?.(t))??br(e?.error?.(t))??br(r.customError?.(t))??br(r.localeError?.(t))??"Invalid input",{inst:o,continue:s,input:i,...a}=t;return a.path??(a.path=[]),a.message=n,e?.reportInput&&(a.input=i),a}function Sc(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function xr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function us(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Jt(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Bg(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function zc(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function kc(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Jg(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return zc(e+r)}function Hg(t){return kc(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Gg(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Kg(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var ts=class{constructor(...e){}};var Pc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Vt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Tn=_("$ZodError",Pc),ls=_("$ZodError",Pc,{Parent:Error});function Ec(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Tc(t,e=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(e(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(e(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return n(t),r}var Nn=t=>(e,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new He;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>Ae(c,s,Ne())));throw Pn(a,o?.callee),a}return i.value};var On=t=>async(e,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>Ae(c,s,Ne())));throw Pn(a,o?.callee),a}return i.value};var Sr=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new He;return s.issues.length?{success:!1,error:new(t??Tn)(s.issues.map(i=>Ae(i,o,Ne())))}:{success:!0,data:s.value}},zr=Sr(ls),kr=t=>async(e,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Ae(i,o,Ne())))}:{success:!0,data:s.value}},Rn=kr(ls),Nc=t=>(e,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Nn(t)(e,r,o)};var Oc=t=>(e,r,n)=>Nn(t)(e,r,n);var Rc=t=>async(e,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return On(t)(e,r,o)};var Ac=t=>async(e,r,n)=>On(t)(e,r,n);var Ic=t=>(e,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Sr(t)(e,r,o)};var Cc=t=>(e,r,n)=>Sr(t)(e,r,n);var jc=t=>async(e,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return kr(t)(e,r,o)};var Zc=t=>async(e,r,n)=>kr(t)(e,r,n);var qc=/^[cC][0-9a-z]{6,}$/,Mc=/^[0-9a-z]+$/,Lc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Dc=/^[0-9a-vA-V]{20}$/,Uc=/^[A-Za-z0-9]{27}$/,Fc=/^[a-zA-Z0-9_-]{21}$/,Vc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Bc=/^([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})$/,ds=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Jc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Yg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hc(){return new RegExp(Yg,"u")}var Gc=/^(?:(?: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])$/,Kc=/^(([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 Wc=/^((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])$/,Yc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ps=/^[A-Za-z0-9_-]*$/;var Qc=/^https?$/,eu=/^\+[1-9]\d{6,14}$/,tu="(?:(?:\\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])))",ru=new RegExp(`^${tu}$`);function nu(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ou(t){return new RegExp(`^${nu(t)}$`)}function su(t){let e=nu({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${tu}T(?:${n})$`)}var iu=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var au=/^-?\d+$/,fs=/^-?\d+(?:\.\d+)?$/,cu=/^(?:true|false)$/i,uu=/^null$/i;var lu=/^[^A-Z]*$/,du=/^[^a-z]*$/;var le=_("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pu={number:"number",bigint:"bigint",object:"date"},ms=_("$ZodCheckLessThan",(t,e)=>{le.init(t,e);let r=pu[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),hs=_("$ZodCheckGreaterThan",(t,e)=>{le.init(t,e);let r=pu[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),fu=_("$ZodCheckMultipleOf",(t,e)=>{le.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):rs(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),mu=_("$ZodCheckNumberFormat",(t,e)=>{le.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=as[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=au)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});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:t,origin:n,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}});var hu=_("$ZodCheckMaxLength",(t,e)=>{var r;le.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!$r(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let i=xr(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),gu=_("$ZodCheckMinLength",(t,e)=>{var r;le.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!$r(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let i=xr(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),_u=_("$ZodCheckLengthEquals",(t,e)=>{var r;le.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!$r(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let i=xr(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Pr=_("$ZodCheckStringFormat",(t,e)=>{var r,n;le.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),yu=_("$ZodCheckRegex",(t,e)=>{Pr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),bu=_("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=lu),Pr.init(t,e)}),vu=_("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=du),Pr.init(t,e)}),$u=_("$ZodCheckIncludes",(t,e)=>{le.init(t,e);let r=et(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),wu=_("$ZodCheckStartsWith",(t,e)=>{le.init(t,e);let r=new RegExp(`^${et(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),xu=_("$ZodCheckEndsWith",(t,e)=>{le.init(t,e);let r=new RegExp(`.*${et(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var Su=_("$ZodCheckOverwrite",(t,e)=>{le.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var In=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
16
+ `).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 e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
17
+ `))}};var ku={major:4,minor:4,patch:3};var G=_("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=ku;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,a,c)=>{let u=lt(i),l;for(let d of a){if(d._zod.def.when){if(cs(i)||!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new He;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=lt(i,p)))});else{if(i.issues.length===p)continue;u||(u=lt(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(lt(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new He;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){let u=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new He;return c.then(u=>o(u,n,a))}return o(c,n,a)}}U(t,"~standard",()=>({validate:o=>{try{let s=zr(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Rn(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Zn=_("$ZodString",(t,e)=>{G.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??iu(t._zod.bag),t._zod.parse=(r,n)=>{if(e.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:t}),r}}),K=_("$ZodStringFormat",(t,e)=>{Pr.init(t,e),Zn.init(t,e)}),Cu=_("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Bc),K.init(t,e)}),ju=_("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=ds(n))}else e.pattern??(e.pattern=ds());K.init(t,e)}),Zu=_("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Jc),K.init(t,e)}),qu=_("$ZodURL",(t,e)=>{K.init(t,e),t._zod.check=r=>{try{let n=r.value.trim();if(!e.normalize&&e.protocol?.source===Qc.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Mu=_("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Hc()),K.init(t,e)}),Lu=_("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Fc),K.init(t,e)}),Du=_("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=qc),K.init(t,e)}),Uu=_("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Mc),K.init(t,e)}),Fu=_("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Lc),K.init(t,e)}),Vu=_("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Dc),K.init(t,e)}),Bu=_("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Uc),K.init(t,e)}),Ju=_("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=su(e)),K.init(t,e)}),Hu=_("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ru),K.init(t,e)}),Gu=_("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ou(e)),K.init(t,e)}),Ku=_("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Vc),K.init(t,e)}),Wu=_("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Gc),K.init(t,e),t._zod.bag.format="ipv4"}),Yu=_("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Kc),K.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Xu=_("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Wc),K.init(t,e)}),Qu=_("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Yc),K.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,s]=n;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function el(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var tl=_("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Xc),K.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{el(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function e_(t){if(!ps.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return el(r)}var rl=_("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ps),K.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{e_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),nl=_("$ZodE164",(t,e)=>{e.pattern??(e.pattern=eu),K.init(t,e)});function t_(t,e=null){try{let r=t.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||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var ol=_("$ZodJWT",(t,e)=>{K.init(t,e),t._zod.check=r=>{t_(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var _s=_("$ZodNumber",(t,e)=>{G.init(t,e),t._zod.pattern=t._zod.bag.pattern??fs,t._zod.parse=(r,n)=>{if(e.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:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),sl=_("$ZodNumberFormat",(t,e)=>{mu.init(t,e),_s.init(t,e)}),il=_("$ZodBoolean",(t,e)=>{G.init(t,e),t._zod.pattern=cu,t._zod.parse=(r,n)=>{if(e.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:t}),r}});var al=_("$ZodNull",(t,e)=>{G.init(t,e),t._zod.pattern=uu,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}});var cl=_("$ZodUnknown",(t,e)=>{G.init(t,e),t._zod.parse=r=>r}),ul=_("$ZodNever",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Pu(t,e,r){t.issues.length&&e.issues.push(...tt(r,t.issues)),e.value[r]=t.value}var ll=_("$ZodArray",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Pu(u,r,i))):Pu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function jn(t,e,r,n,o,s){let i=r in n;if(t.issues.length){if(o&&s&&!i)return;e.issues.push(...tt(r,t.issues))}if(!i&&!o){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?i&&(e.value[r]=void 0):e.value[r]=t.value}function dl(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=is(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function pl(t,e,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let p in e){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let f=c.run({value:e[p],issues:[]},n);f instanceof Promise?t.push(f.then(m=>jn(m,r,p,e,l,d))):jn(f,r,p,e,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var r_=_("$ZodObject",(t,e)=>{if(G.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=Bt(()=>dl(e));U(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=St,s=e.catchall,i;t._zod.parse=(a,c)=>{i??(i=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=i.shape;for(let p of i.keys){let f=d[p],m=f._zod.optin==="optional",y=f._zod.optout==="optional",g=f._zod.run({value:u[p],issues:[]},c);g instanceof Promise?l.push(g.then(b=>jn(b,a,p,u,m,y))):jn(g,a,p,u,m,y)}return s?pl(l,u,a,c,n.value,t):l.length?Promise.all(l).then(()=>a):a}}),fl=_("$ZodObjectJIT",(t,e)=>{r_.init(t,e);let r=t._zod.parse,n=Bt(()=>dl(e)),o=p=>{let f=new In(["shape","payload","ctx"]),m=n.value,y=$=>{let S=kn($);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let g=Object.create(null),b=0;for(let $ of m.keys)g[$]=`key_${b++}`;f.write("const newResult = {};");for(let $ of m.keys){let S=g[$],z=kn($),V=p[$],ie=V?._zod?.optin==="optional",at=V?._zod?.optout==="optional";f.write(`const ${S} = ${y($)};`),ie&&at?f.write(`
18
+ if (${S}.issues.length) {
19
+ if (${z} in input) {
20
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
21
+ ...iss,
22
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
23
+ })));
24
+ }
25
+ }
26
+
27
+ if (${S}.value === undefined) {
28
+ if (${z} in input) {
29
+ newResult[${z}] = undefined;
30
+ }
31
+ } else {
32
+ newResult[${z}] = ${S}.value;
33
+ }
34
+
35
+ `):ie?f.write(`
36
+ if (${S}.issues.length) {
37
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
38
+ ...iss,
39
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
40
+ })));
41
+ }
42
+
43
+ if (${S}.value === undefined) {
44
+ if (${z} in input) {
45
+ newResult[${z}] = undefined;
46
+ }
47
+ } else {
48
+ newResult[${z}] = ${S}.value;
49
+ }
50
+
51
+ `):f.write(`
52
+ const ${S}_present = ${z} in input;
53
+ if (${S}.issues.length) {
54
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
55
+ ...iss,
56
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
57
+ })));
58
+ }
59
+ if (!${S}_present && !${S}.issues.length) {
60
+ payload.issues.push({
61
+ code: "invalid_type",
62
+ expected: "nonoptional",
63
+ input: undefined,
64
+ path: [${z}]
65
+ });
66
+ }
67
+
68
+ if (${S}_present) {
69
+ if (${S}.value === undefined) {
70
+ newResult[${z}] = undefined;
71
+ } else {
72
+ newResult[${z}] = ${S}.value;
73
+ }
74
+ }
75
+
76
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let w=f.compile();return($,S)=>w(p,$,S)},s,i=St,a=!Ft.jitless,u=a&&os.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let m=p.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(e.shape)),p=s(p,f),l?pl([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function Eu(t,e,r,n){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let o=t.filter(s=>!lt(s));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(i=>Ae(i,n,Ne())))}),e)}var ys=_("$ZodUnion",(t,e)=>{G.init(t,e),U(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),U(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),U(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),U(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>wr(o.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of e.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=>Eu(a,n,t,o)):Eu(i,n,t,o)}});var ml=_("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ys.init(t,e);let r=t._zod.parse;U(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Bt(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!St(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(n.value.keys()),input:i,path:[e.discriminator],inst:t}),o)}}),hl=_("$ZodIntersection",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Tu(r,c,u)):Tu(r,s,i)}});function gs(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(ut(t)&&ut(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=gs(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],i=gs(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 Tu(t,e,r){let n=new Map,o;for(let a of e.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(a);let s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&t.issues.push({...o,keys:s}),lt(t))return t;let i=gs(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}var gl=_("$ZodRecord",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!ut(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[],i=e.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Ae(f,n,Ne())),input:u,path:[u],inst:t});continue}let d=l.value,p=e.valueType._zod.run({value:o[u],issues:[]},n);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...tt(u,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...tt(u,p.issues)),r.value[d]=p.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&fs.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Ae(d,n,Ne())),input:a,path:[a],inst:t});continue}let l=e.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...tt(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...tt(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var _l=_("$ZodEnum",(t,e)=>{G.init(t,e);let r=vr(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>ss.has(typeof o)).map(o=>typeof o=="string"?et(o):o.toString()).join("|")})$`),t._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:t}),o}}),yl=_("$ZodLiteral",(t,e)=>{if(G.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?et(n):n?et(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),n}});var bl=_("$ZodTransform",(t,e)=>{G.init(t,e),t._zod.optin="optional",t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ut(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new He;return r.value=o,r.fallback=!0,r}});function Nu(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var bs=_("$ZodOptional",(t,e)=>{G.init(t,e),t._zod.optin="optional",t._zod.optout="optional",U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${wr(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=r.value,s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Nu(i,o)):Nu(s,o)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),vl=_("$ZodExactOptional",(t,e)=>{bs.init(t,e),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),$l=_("$ZodNullable",(t,e)=>{G.init(t,e),U(t._zod,"optin",()=>e.innerType._zod.optin),U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${wr(r.source)}|null)$`):void 0}),U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),wl=_("$ZodDefault",(t,e)=>{G.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ou(s,e)):Ou(o,e)}});function Ou(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var xl=_("$ZodPrefault",(t,e)=>{G.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Sl=_("$ZodNonOptional",(t,e)=>{G.init(t,e),U(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ru(s,t)):Ru(o,t)}});function Ru(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var zl=_("$ZodCatch",(t,e)=>{G.init(t,e),t._zod.optin="optional",U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Ae(i,n,Ne()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>Ae(s,n,Ne()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var vs=_("$ZodPipe",(t,e)=>{G.init(t,e),U(t._zod,"values",()=>e.in._zod.values),U(t._zod,"optin",()=>e.in._zod.optin),U(t._zod,"optout",()=>e.out._zod.optout),U(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=e.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Cn(i,e.in,n)):Cn(s,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Cn(s,e.out,n)):Cn(o,e.out,n)}});function Cn(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var kl=_("$ZodPreprocess",(t,e)=>{vs.init(t,e)}),Pl=_("$ZodReadonly",(t,e)=>{G.init(t,e),U(t._zod,"propValues",()=>e.innerType._zod.propValues),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"optin",()=>e.innerType?._zod?.optin),U(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Au):Au(o)}});function Au(t){return t.value=Object.freeze(t.value),t}var El=_("$ZodCustom",(t,e)=>{le.init(t,e),G.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>Iu(s,r,n,t));Iu(o,r,n,t)}});function Iu(t,e,r,n){if(!t){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),e.issues.push(Jt(o))}}var n_=()=>{let t={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 e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",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",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=n[o.expected]??o.expected,i=us(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${En(o.values[0])}`:`Invalid option: expected one of ${zn(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",i=e(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",i=e(o.origin);return i?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${zn(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Tl(){return{localeError:n_()}}var Nl;var $s=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function o_(){return new $s}(Nl=globalThis).__zod_globalRegistry??(Nl.__zod_globalRegistry=o_());var zt=globalThis.__zod_globalRegistry;function Ol(t,e){return new t({type:"string",...E(e)})}function Rl(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function ws(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function Al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function Il(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function Cl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function jl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function Zl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function ql(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function Ml(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function Ll(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function Dl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function Ul(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function Fl(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function Vl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function Bl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function Jl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function Hl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function Gl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function Kl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function Wl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function Yl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function Xl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function Ql(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function ed(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function td(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function rd(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function nd(t,e){return new t({type:"number",checks:[],...E(e)})}function od(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function sd(t,e){return new t({type:"boolean",...E(e)})}function id(t,e){return new t({type:"null",...E(e)})}function ad(t){return new t({type:"unknown"})}function cd(t,e){return new t({type:"never",...E(e)})}function qn(t,e){return new ms({check:"less_than",...E(e),value:t,inclusive:!1})}function Er(t,e){return new ms({check:"less_than",...E(e),value:t,inclusive:!0})}function Mn(t,e){return new hs({check:"greater_than",...E(e),value:t,inclusive:!1})}function Tr(t,e){return new hs({check:"greater_than",...E(e),value:t,inclusive:!0})}function Ln(t,e){return new fu({check:"multiple_of",...E(e),value:t})}function Dn(t,e){return new hu({check:"max_length",...E(e),maximum:t})}function Ht(t,e){return new gu({check:"min_length",...E(e),minimum:t})}function Un(t,e){return new _u({check:"length_equals",...E(e),length:t})}function xs(t,e){return new yu({check:"string_format",format:"regex",...E(e),pattern:t})}function Ss(t){return new bu({check:"string_format",format:"lowercase",...E(t)})}function zs(t){return new vu({check:"string_format",format:"uppercase",...E(t)})}function ks(t,e){return new $u({check:"string_format",format:"includes",...E(e),includes:t})}function Ps(t,e){return new wu({check:"string_format",format:"starts_with",...E(e),prefix:t})}function Es(t,e){return new xu({check:"string_format",format:"ends_with",...E(e),suffix:t})}function dt(t){return new Su({check:"overwrite",tx:t})}function Ts(t){return dt(e=>e.normalize(t))}function Ns(){return dt(t=>t.trim())}function Os(){return dt(t=>t.toLowerCase())}function Rs(){return dt(t=>t.toUpperCase())}function As(){return dt(t=>ns(t))}function ud(t,e,r){return new t({type:"array",element:e,...E(r)})}function ld(t,e,r){let n=E(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function dd(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function pd(t,e){let r=s_(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Jt(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Jt(s))}},t(n.value,n)),e);return r}function s_(t,e){let r=new le({check:"custom",...E(e)});return r._zod.check=t,r}function Is(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??zt,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function ne(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,s=e.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i);let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,l);else{let p=i.schema,f=e.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),ne(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&be(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function Cs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of t.seen.entries()){let a=t.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=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(i[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+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(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
77
+
78
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){s(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function js(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=t.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=t.seen.get(d),m=f.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===d)for(let g in u)g==="$ref"||g==="allOf"||g in l||delete u[g];if(m.$ref&&f.def)for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}let p=a._zod.parent;if(p&&p!==d){n(p);let f=t.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&o.id===s&&delete o.id;let i=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Nr(e,"input",t.processors),output:Nr(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function be(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return be(n.element,r);if(n.type==="set")return be(n.valueType,r);if(n.type==="lazy")return be(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")return be(n.innerType,r);if(n.type==="intersection")return be(n.left,r)||be(n.right,r);if(n.type==="record"||n.type==="map")return be(n.keyType,r)||be(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:be(n.in,r)||be(n.out,r);if(n.type==="object"){for(let o in n.shape)if(be(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(be(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(be(o,r))return!0;return!!(n.rest&&be(n.rest,r))}return!1}var fd=(t,e={})=>r=>{let n=Is({...r,processors:e});return ne(t,n),Cs(n,t),js(n,t)},Nr=(t,e,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=Is({...o??{},target:s,io:e,processors:r});return ne(t,i),Cs(i,t),js(i,t)};var i_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},md=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=i_[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},hd=(t,e,r,n)=>{let o=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof s=="number"&&(o.minimum=s),p?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),typeof c=="number"&&(o.multipleOf=c)},gd=(t,e,r,n)=>{r.type="boolean"};var _d=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var yd=(t,e,r,n)=>{r.not={}};var bd=(t,e,r,n)=>{};var vd=(t,e,r,n)=>{let o=t._zod.def,s=vr(o.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},$d=(t,e,r,n)=>{let o=t._zod.def,s=[];for(let i of o.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");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,e.target==="draft-04"||e.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 wd=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var xd=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Sd=(t,e,r,n)=>{let o=r,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=ne(s.element,e,{...n,path:[...n.path,"items"]})},zd=(t,e,r,n)=>{let o=r,s=t._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=ne(i[u],e,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ne(s.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},kd=(t,e,r,n)=>{let o=t._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>ne(a,e,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Pd=(t,e,r,n)=>{let o=t._zod.def,s=ne(o.left,e,{...n,path:[...n.path,"allOf",0]}),i=ne(o.right,e,{...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};var Ed=(t,e,r,n)=>{let o=r,s=t._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=ne(s.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=ne(s.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=ne(s.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Td=(t,e,r,n)=>{let o=t._zod.def,s=ne(o.innerType,e,n),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Nd=(t,e,r,n)=>{let o=t._zod.def;ne(o.innerType,e,n);let s=e.seen.get(t);s.ref=o.innerType},Od=(t,e,r,n)=>{let o=t._zod.def;ne(o.innerType,e,n);let s=e.seen.get(t);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Rd=(t,e,r,n)=>{let o=t._zod.def;ne(o.innerType,e,n);let s=e.seen.get(t);s.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ad=(t,e,r,n)=>{let o=t._zod.def;ne(o.innerType,e,n);let s=e.seen.get(t);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Id=(t,e,r,n)=>{let o=t._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?s?o.out:o.in:o.out;ne(i,e,n);let a=e.seen.get(t);a.ref=i},Cd=(t,e,r,n)=>{let o=t._zod.def;ne(o.innerType,e,n);let s=e.seen.get(t);s.ref=o.innerType,r.readOnly=!0};var Zs=(t,e,r,n)=>{let o=t._zod.def;ne(o.innerType,e,n);let s=e.seen.get(t);s.ref=o.innerType};function Gt(t){return!!t._zod}function pt(t,e){return Gt(t)?zr(t,e):t.safeParse(e)}function Fn(t){if(!t)return;let e;if(Gt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function jd(t){if(Gt(t)){let s=t._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=t._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=t.value;if(n!==void 0)return n}var Rr={};yc(Rr,{ZodISODate:()=>qd,ZodISODateTime:()=>Zd,ZodISODuration:()=>Ld,ZodISOTime:()=>Md,date:()=>Ms,datetime:()=>qs,duration:()=>Ds,time:()=>Ls});var Zd=_("ZodISODateTime",(t,e)=>{Ju.init(t,e),Q.init(t,e)});function qs(t){return Ql(Zd,t)}var qd=_("ZodISODate",(t,e)=>{Hu.init(t,e),Q.init(t,e)});function Ms(t){return ed(qd,t)}var Md=_("ZodISOTime",(t,e)=>{Gu.init(t,e),Q.init(t,e)});function Ls(t){return td(Md,t)}var Ld=_("ZodISODuration",(t,e)=>{Ku.init(t,e),Q.init(t,e)});function Ds(t){return rd(Ld,t)}var h_=(t,e)=>{Tn.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Tc(t,r)},flatten:{value:r=>Ec(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Vt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Vt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var Oe=_("ZodError",h_,{Parent:Error});var Dd=Nn(Oe),Ud=On(Oe),Fd=Sr(Oe),Vd=kr(Oe),Bd=Nc(Oe),Jd=Oc(Oe),Hd=Rc(Oe),Gd=Ac(Oe),Kd=Ic(Oe),Wd=Cc(Oe),Yd=jc(Oe),Xd=Zc(Oe);var Qd=new WeakMap;function Ar(t,e,r){let n=Object.getPrototypeOf(t),o=Qd.get(n);if(o||(o=new Set,Qd.set(n,o)),!o.has(e)){o.add(e);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var re=_("ZodType",(t,e)=>(G.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Nr(t,"input"),output:Nr(t,"output")}}),t.toJSONSchema=fd(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>Dd(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Fd(t,r,n),t.parseAsync=async(r,n)=>Ud(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Vd(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Bd(t,r,n),t.decode=(r,n)=>Jd(t,r,n),t.encodeAsync=async(r,n)=>Hd(t,r,n),t.decodeAsync=async(r,n)=>Gd(t,r,n),t.safeEncode=(r,n)=>Kd(t,r,n),t.safeDecode=(r,n)=>Wd(t,r,n),t.safeEncodeAsync=async(r,n)=>Yd(t,r,n),t.safeDecodeAsync=async(r,n)=>Xd(t,r,n),Ar(t,"ZodType",{check(...r){let n=this.def;return this.clone(q.mergeDefs(n,{checks:[...n.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Le(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(sy(r,n))},superRefine(r,n){return this.check(iy(r,n))},overwrite(r){return this.check(dt(r))},optional(){return te(this)},exactOptional(){return H_(this)},nullable(){return np(this)},nullish(){return te(np(this))},nonoptional(r){return Q_(this,r)},array(){return j(this)},or(r){return W([this,r])},and(r){return Bn(this,r)},transform(r){return op(this,lp(r))},default(r){return W_(this,r)},prefault(r){return X_(this,r)},catch(r){return ty(this,r)},pipe(r){return op(this,r)},readonly(){return oy(this)},describe(r){let n=this.clone();return zt.add(n,{description:r}),n},meta(...r){if(r.length===0)return zt.get(this);let n=this.clone();return zt.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return zt.get(t)?.description},configurable:!0}),t)),sp=_("_ZodString",(t,e)=>{Zn.init(t,e),re.init(t,e),t._zod.processJSONSchema=(n,o,s)=>md(t,n,o,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Ar(t,"_ZodString",{regex(...n){return this.check(xs(...n))},includes(...n){return this.check(ks(...n))},startsWith(...n){return this.check(Ps(...n))},endsWith(...n){return this.check(Es(...n))},min(...n){return this.check(Ht(...n))},max(...n){return this.check(Dn(...n))},length(...n){return this.check(Un(...n))},nonempty(...n){return this.check(Ht(1,...n))},lowercase(n){return this.check(Ss(n))},uppercase(n){return this.check(zs(n))},trim(){return this.check(Ns())},normalize(...n){return this.check(Ts(...n))},toLowerCase(){return this.check(Os())},toUpperCase(){return this.check(Rs())},slugify(){return this.check(As())}})}),__=_("ZodString",(t,e)=>{Zn.init(t,e),sp.init(t,e),t.email=r=>t.check(Rl(y_,r)),t.url=r=>t.check(Zl(b_,r)),t.jwt=r=>t.check(Xl(I_,r)),t.emoji=r=>t.check(ql(v_,r)),t.guid=r=>t.check(ws(ep,r)),t.uuid=r=>t.check(Al(Vn,r)),t.uuidv4=r=>t.check(Il(Vn,r)),t.uuidv6=r=>t.check(Cl(Vn,r)),t.uuidv7=r=>t.check(jl(Vn,r)),t.nanoid=r=>t.check(Ml($_,r)),t.guid=r=>t.check(ws(ep,r)),t.cuid=r=>t.check(Ll(w_,r)),t.cuid2=r=>t.check(Dl(x_,r)),t.ulid=r=>t.check(Ul(S_,r)),t.base64=r=>t.check(Kl(O_,r)),t.base64url=r=>t.check(Wl(R_,r)),t.xid=r=>t.check(Fl(z_,r)),t.ksuid=r=>t.check(Vl(k_,r)),t.ipv4=r=>t.check(Bl(P_,r)),t.ipv6=r=>t.check(Jl(E_,r)),t.cidrv4=r=>t.check(Hl(T_,r)),t.cidrv6=r=>t.check(Gl(N_,r)),t.e164=r=>t.check(Yl(A_,r)),t.datetime=r=>t.check(qs(r)),t.date=r=>t.check(Ms(r)),t.time=r=>t.check(Ls(r)),t.duration=r=>t.check(Ds(r))});function h(t){return Ol(__,t)}var Q=_("ZodStringFormat",(t,e)=>{K.init(t,e),sp.init(t,e)}),y_=_("ZodEmail",(t,e)=>{Zu.init(t,e),Q.init(t,e)});var ep=_("ZodGUID",(t,e)=>{Cu.init(t,e),Q.init(t,e)});var Vn=_("ZodUUID",(t,e)=>{ju.init(t,e),Q.init(t,e)});var b_=_("ZodURL",(t,e)=>{qu.init(t,e),Q.init(t,e)});var v_=_("ZodEmoji",(t,e)=>{Mu.init(t,e),Q.init(t,e)});var $_=_("ZodNanoID",(t,e)=>{Lu.init(t,e),Q.init(t,e)});var w_=_("ZodCUID",(t,e)=>{Du.init(t,e),Q.init(t,e)});var x_=_("ZodCUID2",(t,e)=>{Uu.init(t,e),Q.init(t,e)});var S_=_("ZodULID",(t,e)=>{Fu.init(t,e),Q.init(t,e)});var z_=_("ZodXID",(t,e)=>{Vu.init(t,e),Q.init(t,e)});var k_=_("ZodKSUID",(t,e)=>{Bu.init(t,e),Q.init(t,e)});var P_=_("ZodIPv4",(t,e)=>{Wu.init(t,e),Q.init(t,e)});var E_=_("ZodIPv6",(t,e)=>{Yu.init(t,e),Q.init(t,e)});var T_=_("ZodCIDRv4",(t,e)=>{Xu.init(t,e),Q.init(t,e)});var N_=_("ZodCIDRv6",(t,e)=>{Qu.init(t,e),Q.init(t,e)});var O_=_("ZodBase64",(t,e)=>{tl.init(t,e),Q.init(t,e)});var R_=_("ZodBase64URL",(t,e)=>{rl.init(t,e),Q.init(t,e)});var A_=_("ZodE164",(t,e)=>{nl.init(t,e),Q.init(t,e)});var I_=_("ZodJWT",(t,e)=>{ol.init(t,e),Q.init(t,e)});var ip=_("ZodNumber",(t,e)=>{_s.init(t,e),re.init(t,e),t._zod.processJSONSchema=(n,o,s)=>hd(t,n,o,s),Ar(t,"ZodNumber",{gt(n,o){return this.check(Mn(n,o))},gte(n,o){return this.check(Tr(n,o))},min(n,o){return this.check(Tr(n,o))},lt(n,o){return this.check(qn(n,o))},lte(n,o){return this.check(Er(n,o))},max(n,o){return this.check(Er(n,o))},int(n){return this.check(tp(n))},safe(n){return this.check(tp(n))},positive(n){return this.check(Mn(0,n))},nonnegative(n){return this.check(Tr(0,n))},negative(n){return this.check(qn(0,n))},nonpositive(n){return this.check(Er(0,n))},multipleOf(n,o){return this.check(Ln(n,o))},step(n,o){return this.check(Ln(n,o))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function F(t){return nd(ip,t)}var C_=_("ZodNumberFormat",(t,e)=>{sl.init(t,e),ip.init(t,e)});function tp(t){return od(C_,t)}var j_=_("ZodBoolean",(t,e)=>{il.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>gd(t,r,n,o)});function ue(t){return sd(j_,t)}var Z_=_("ZodNull",(t,e)=>{al.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>_d(t,r,n,o)});function ap(t){return id(Z_,t)}var q_=_("ZodUnknown",(t,e)=>{cl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>bd(t,r,n,o)});function ee(){return ad(q_)}var M_=_("ZodNever",(t,e)=>{ul.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>yd(t,r,n,o)});function L_(t){return cd(M_,t)}var D_=_("ZodArray",(t,e)=>{ll.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Sd(t,r,n,o),t.element=e.element,Ar(t,"ZodArray",{min(r,n){return this.check(Ht(r,n))},nonempty(r){return this.check(Ht(1,r))},max(r,n){return this.check(Dn(r,n))},length(r,n){return this.check(Un(r,n))},unwrap(){return this.element}})});function j(t,e){return ud(D_,t,e)}var cp=_("ZodObject",(t,e)=>{fl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>zd(t,r,n,o),q.defineLazy(t,"shape",()=>e.shape),Ar(t,"ZodObject",{keyof(){return Se(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ee()})},loose(){return this.clone({...this._zod.def,catchall:ee()})},strict(){return this.clone({...this._zod.def,catchall:L_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return q.extend(this,r)},safeExtend(r){return q.safeExtend(this,r)},merge(r){return q.merge(this,r)},pick(r){return q.pick(this,r)},omit(r){return q.omit(this,r)},partial(...r){return q.partial(dp,this,r[0])},required(...r){return q.required(pp,this,r[0])}})});function x(t,e){let r={type:"object",shape:t??{},...q.normalizeParams(e)};return new cp(r)}function ve(t,e){return new cp({type:"object",shape:t,catchall:ee(),...q.normalizeParams(e)})}var up=_("ZodUnion",(t,e)=>{ys.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>kd(t,r,n,o),t.options=e.options});function W(t,e){return new up({type:"union",options:t,...q.normalizeParams(e)})}var U_=_("ZodDiscriminatedUnion",(t,e)=>{up.init(t,e),ml.init(t,e)});function Fs(t,e,r){return new U_({type:"union",options:e,discriminator:t,...q.normalizeParams(r)})}var F_=_("ZodIntersection",(t,e)=>{hl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Pd(t,r,n,o)});function Bn(t,e){return new F_({type:"intersection",left:t,right:e})}var rp=_("ZodRecord",(t,e)=>{gl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ed(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function H(t,e,r){return!e||!e._zod?new rp({type:"record",keyType:h(),valueType:t,...q.normalizeParams(e)}):new rp({type:"record",keyType:t,valueType:e,...q.normalizeParams(r)})}var Us=_("ZodEnum",(t,e)=>{_l.init(t,e),re.init(t,e),t._zod.processJSONSchema=(n,o,s)=>vd(t,n,o,s),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Us({...e,checks:[],...q.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.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 Us({...e,checks:[],...q.normalizeParams(o),entries:s})}});function Se(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Us({type:"enum",entries:r,...q.normalizeParams(e)})}var V_=_("ZodLiteral",(t,e)=>{yl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>$d(t,r,n,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function k(t,e){return new V_({type:"literal",values:Array.isArray(t)?t:[t],...q.normalizeParams(e)})}var B_=_("ZodTransform",(t,e)=>{bl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>xd(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ut(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(q.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),r.issues.push(q.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function lp(t){return new B_({type:"transform",transform:t})}var dp=_("ZodOptional",(t,e)=>{bs.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Zs(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function te(t){return new dp({type:"optional",innerType:t})}var J_=_("ZodExactOptional",(t,e)=>{vl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Zs(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function H_(t){return new J_({type:"optional",innerType:t})}var G_=_("ZodNullable",(t,e)=>{$l.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Td(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function np(t){return new G_({type:"nullable",innerType:t})}var K_=_("ZodDefault",(t,e)=>{wl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Od(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function W_(t,e){return new K_({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():q.shallowClone(e)}})}var Y_=_("ZodPrefault",(t,e)=>{xl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Rd(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function X_(t,e){return new Y_({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():q.shallowClone(e)}})}var pp=_("ZodNonOptional",(t,e)=>{Sl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Nd(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Q_(t,e){return new pp({type:"nonoptional",innerType:t,...q.normalizeParams(e)})}var ey=_("ZodCatch",(t,e)=>{zl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ad(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function ty(t,e){return new ey({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var fp=_("ZodPipe",(t,e)=>{vs.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Id(t,r,n,o),t.in=e.in,t.out=e.out});function op(t,e){return new fp({type:"pipe",in:t,out:e})}var ry=_("ZodPreprocess",(t,e)=>{fp.init(t,e),kl.init(t,e)}),ny=_("ZodReadonly",(t,e)=>{Pl.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Cd(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function oy(t){return new ny({type:"readonly",innerType:t})}var mp=_("ZodCustom",(t,e)=>{El.init(t,e),re.init(t,e),t._zod.processJSONSchema=(r,n,o)=>wd(t,r,n,o)});function hp(t,e){return ld(mp,t??(()=>!0),e)}function sy(t,e={}){return dd(mp,t,e)}function iy(t,e){return pd(t,e)}function Vs(t,e){return new ry({type:"pipe",in:lp(t),out:e})}Ne(Tl());var Js="2025-11-25";var gp=[Js,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ft="io.modelcontextprotocol/related-task",Hn="2.0",ae=hp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),_p=W([h(),F().int()]),yp=h(),jE=ve({ttl:F().optional(),pollInterval:F().optional()}),ay=x({ttl:F().optional()}),cy=x({taskId:h()}),Hs=ve({progressToken:_p.optional(),[ft]:cy.optional()}),Re=x({_meta:Hs.optional()}),Ir=Re.extend({task:ay.optional()}),bp=t=>Ir.safeParse(t).success,de=x({method:h(),params:Re.loose().optional()}),Ie=x({_meta:Hs.optional()}),Ce=x({method:h(),params:Ie.loose().optional()}),pe=ve({_meta:Hs.optional()}),Gn=W([h(),F().int()]),vp=x({jsonrpc:k(Hn),id:Gn,...de.shape}).strict(),Gs=t=>vp.safeParse(t).success,$p=x({jsonrpc:k(Hn),...Ce.shape}).strict(),wp=t=>$p.safeParse(t).success,Ks=x({jsonrpc:k(Hn),id:Gn,result:pe}).strict(),Cr=t=>Ks.safeParse(t).success;var C;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(C||(C={}));var Ws=x({jsonrpc:k(Hn),id:Gn.optional(),error:x({code:F().int(),message:h(),data:ee().optional()})}).strict();var xp=t=>Ws.safeParse(t).success;var Sp=W([vp,$p,Ks,Ws]),ZE=W([Ks,Ws]),Kn=pe.strict(),uy=Ie.extend({requestId:Gn.optional(),reason:h().optional()}),Wn=Ce.extend({method:k("notifications/cancelled"),params:uy}),ly=x({src:h(),mimeType:h().optional(),sizes:j(h()).optional(),theme:Se(["light","dark"]).optional()}),jr=x({icons:j(ly).optional()}),Kt=x({name:h(),title:h().optional()}),zp=Kt.extend({...Kt.shape,...jr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),dy=Bn(x({applyDefaults:ue().optional()}),H(h(),ee())),py=Vs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Bn(x({form:dy.optional(),url:ae.optional()}),H(h(),ee()).optional())),fy=ve({list:ae.optional(),cancel:ae.optional(),requests:ve({sampling:ve({createMessage:ae.optional()}).optional(),elicitation:ve({create:ae.optional()}).optional()}).optional()}),my=ve({list:ae.optional(),cancel:ae.optional(),requests:ve({tools:ve({call:ae.optional()}).optional()}).optional()}),hy=x({experimental:H(h(),ae).optional(),sampling:x({context:ae.optional(),tools:ae.optional()}).optional(),elicitation:py.optional(),roots:x({listChanged:ue().optional()}).optional(),tasks:fy.optional(),extensions:H(h(),ae).optional()}),gy=Re.extend({protocolVersion:h(),capabilities:hy,clientInfo:zp}),Ys=de.extend({method:k("initialize"),params:gy});var _y=x({experimental:H(h(),ae).optional(),logging:ae.optional(),completions:ae.optional(),prompts:x({listChanged:ue().optional()}).optional(),resources:x({subscribe:ue().optional(),listChanged:ue().optional()}).optional(),tools:x({listChanged:ue().optional()}).optional(),tasks:my.optional(),extensions:H(h(),ae).optional()}),yy=pe.extend({protocolVersion:h(),capabilities:_y,serverInfo:zp,instructions:h().optional()}),Xs=Ce.extend({method:k("notifications/initialized"),params:Ie.optional()});var Yn=de.extend({method:k("ping"),params:Re.optional()}),by=x({progress:F(),total:te(F()),message:te(h())}),vy=x({...Ie.shape,...by.shape,progressToken:_p}),Xn=Ce.extend({method:k("notifications/progress"),params:vy}),$y=Re.extend({cursor:yp.optional()}),Zr=de.extend({params:$y.optional()}),qr=pe.extend({nextCursor:yp.optional()}),wy=Se(["working","input_required","completed","failed","cancelled"]),Mr=x({taskId:h(),status:wy,ttl:W([F(),ap()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:te(F()),statusMessage:te(h())}),Wt=pe.extend({task:Mr}),xy=Ie.merge(Mr),Lr=Ce.extend({method:k("notifications/tasks/status"),params:xy}),Qn=de.extend({method:k("tasks/get"),params:Re.extend({taskId:h()})}),eo=pe.merge(Mr),to=de.extend({method:k("tasks/result"),params:Re.extend({taskId:h()})}),qE=pe.loose(),ro=Zr.extend({method:k("tasks/list")}),no=qr.extend({tasks:j(Mr)}),oo=de.extend({method:k("tasks/cancel"),params:Re.extend({taskId:h()})}),kp=pe.merge(Mr),Pp=x({uri:h(),mimeType:te(h()),_meta:H(h(),ee()).optional()}),Ep=Pp.extend({text:h()}),Qs=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Tp=Pp.extend({blob:Qs}),Dr=Se(["user","assistant"]),Yt=x({audience:j(Dr).optional(),priority:F().min(0).max(1).optional(),lastModified:Rr.datetime({offset:!0}).optional()}),Np=x({...Kt.shape,...jr.shape,uri:h(),description:te(h()),mimeType:te(h()),size:te(F()),annotations:Yt.optional(),_meta:te(ve({}))}),Sy=x({...Kt.shape,...jr.shape,uriTemplate:h(),description:te(h()),mimeType:te(h()),annotations:Yt.optional(),_meta:te(ve({}))}),zy=Zr.extend({method:k("resources/list")}),ky=qr.extend({resources:j(Np)}),Py=Zr.extend({method:k("resources/templates/list")}),Ey=qr.extend({resourceTemplates:j(Sy)}),ei=Re.extend({uri:h()}),Ty=ei,Ny=de.extend({method:k("resources/read"),params:Ty}),Oy=pe.extend({contents:j(W([Ep,Tp]))}),Ry=Ce.extend({method:k("notifications/resources/list_changed"),params:Ie.optional()}),Ay=ei,Iy=de.extend({method:k("resources/subscribe"),params:Ay}),Cy=ei,jy=de.extend({method:k("resources/unsubscribe"),params:Cy}),Zy=Ie.extend({uri:h()}),qy=Ce.extend({method:k("notifications/resources/updated"),params:Zy}),My=x({name:h(),description:te(h()),required:te(ue())}),Ly=x({...Kt.shape,...jr.shape,description:te(h()),arguments:te(j(My)),_meta:te(ve({}))}),Dy=Zr.extend({method:k("prompts/list")}),Uy=qr.extend({prompts:j(Ly)}),Fy=Re.extend({name:h(),arguments:H(h(),h()).optional()}),Vy=de.extend({method:k("prompts/get"),params:Fy}),ti=x({type:k("text"),text:h(),annotations:Yt.optional(),_meta:H(h(),ee()).optional()}),ri=x({type:k("image"),data:Qs,mimeType:h(),annotations:Yt.optional(),_meta:H(h(),ee()).optional()}),ni=x({type:k("audio"),data:Qs,mimeType:h(),annotations:Yt.optional(),_meta:H(h(),ee()).optional()}),By=x({type:k("tool_use"),name:h(),id:h(),input:H(h(),ee()),_meta:H(h(),ee()).optional()}),Jy=x({type:k("resource"),resource:W([Ep,Tp]),annotations:Yt.optional(),_meta:H(h(),ee()).optional()}),Hy=Np.extend({type:k("resource_link")}),oi=W([ti,ri,ni,Hy,Jy]),Gy=x({role:Dr,content:oi}),Ky=pe.extend({description:h().optional(),messages:j(Gy)}),Wy=Ce.extend({method:k("notifications/prompts/list_changed"),params:Ie.optional()}),Yy=x({title:h().optional(),readOnlyHint:ue().optional(),destructiveHint:ue().optional(),idempotentHint:ue().optional(),openWorldHint:ue().optional()}),Xy=x({taskSupport:Se(["required","optional","forbidden"]).optional()}),Op=x({...Kt.shape,...jr.shape,description:h().optional(),inputSchema:x({type:k("object"),properties:H(h(),ae).optional(),required:j(h()).optional()}).catchall(ee()),outputSchema:x({type:k("object"),properties:H(h(),ae).optional(),required:j(h()).optional()}).catchall(ee()).optional(),annotations:Yy.optional(),execution:Xy.optional(),_meta:H(h(),ee()).optional()}),si=Zr.extend({method:k("tools/list")}),Qy=qr.extend({tools:j(Op)}),so=pe.extend({content:j(oi).default([]),structuredContent:H(h(),ee()).optional(),isError:ue().optional()}),ME=so.or(pe.extend({toolResult:ee()})),eb=Ir.extend({name:h(),arguments:H(h(),ee()).optional()}),Ur=de.extend({method:k("tools/call"),params:eb}),tb=Ce.extend({method:k("notifications/tools/list_changed"),params:Ie.optional()}),LE=x({autoRefresh:ue().default(!0),debounceMs:F().int().nonnegative().default(300)}),Fr=Se(["debug","info","notice","warning","error","critical","alert","emergency"]),rb=Re.extend({level:Fr}),ii=de.extend({method:k("logging/setLevel"),params:rb}),nb=Ie.extend({level:Fr,logger:h().optional(),data:ee()}),ob=Ce.extend({method:k("notifications/message"),params:nb}),sb=x({name:h().optional()}),ib=x({hints:j(sb).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),ab=x({mode:Se(["auto","required","none"]).optional()}),cb=x({type:k("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:j(oi).default([]),structuredContent:x({}).loose().optional(),isError:ue().optional(),_meta:H(h(),ee()).optional()}),ub=Fs("type",[ti,ri,ni]),Jn=Fs("type",[ti,ri,ni,By,cb]),lb=x({role:Dr,content:W([Jn,j(Jn)]),_meta:H(h(),ee()).optional()}),db=Ir.extend({messages:j(lb),modelPreferences:ib.optional(),systemPrompt:h().optional(),includeContext:Se(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:j(h()).optional(),metadata:ae.optional(),tools:j(Op).optional(),toolChoice:ab.optional()}),pb=de.extend({method:k("sampling/createMessage"),params:db}),Vr=pe.extend({model:h(),stopReason:te(Se(["endTurn","stopSequence","maxTokens"]).or(h())),role:Dr,content:ub}),ai=pe.extend({model:h(),stopReason:te(Se(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Dr,content:W([Jn,j(Jn)])}),fb=x({type:k("boolean"),title:h().optional(),description:h().optional(),default:ue().optional()}),mb=x({type:k("string"),title:h().optional(),description:h().optional(),minLength:F().optional(),maxLength:F().optional(),format:Se(["email","uri","date","date-time"]).optional(),default:h().optional()}),hb=x({type:Se(["number","integer"]),title:h().optional(),description:h().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),gb=x({type:k("string"),title:h().optional(),description:h().optional(),enum:j(h()),default:h().optional()}),_b=x({type:k("string"),title:h().optional(),description:h().optional(),oneOf:j(x({const:h(),title:h()})),default:h().optional()}),yb=x({type:k("string"),title:h().optional(),description:h().optional(),enum:j(h()),enumNames:j(h()).optional(),default:h().optional()}),bb=W([gb,_b]),vb=x({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:x({type:k("string"),enum:j(h())}),default:j(h()).optional()}),$b=x({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:x({anyOf:j(x({const:h(),title:h()}))}),default:j(h()).optional()}),wb=W([vb,$b]),xb=W([yb,bb,wb]),Sb=W([xb,fb,mb,hb]),zb=Ir.extend({mode:k("form").optional(),message:h(),requestedSchema:x({type:k("object"),properties:H(h(),Sb),required:j(h()).optional()})}),kb=Ir.extend({mode:k("url"),message:h(),elicitationId:h(),url:h().url()}),Pb=W([zb,kb]),Eb=de.extend({method:k("elicitation/create"),params:Pb}),Tb=Ie.extend({elicitationId:h()}),Nb=Ce.extend({method:k("notifications/elicitation/complete"),params:Tb}),Xt=pe.extend({action:Se(["accept","decline","cancel"]),content:Vs(t=>t===null?void 0:t,H(h(),W([h(),F(),ue(),j(h())])).optional())}),Ob=x({type:k("ref/resource"),uri:h()});var Rb=x({type:k("ref/prompt"),name:h()}),Ab=Re.extend({ref:W([Rb,Ob]),argument:x({name:h(),value:h()}),context:x({arguments:H(h(),h()).optional()}).optional()}),Ib=de.extend({method:k("completion/complete"),params:Ab});var Cb=pe.extend({completion:ve({values:j(h()).max(100),total:te(F().int()),hasMore:te(ue())})}),jb=x({uri:h().startsWith("file://"),name:h().optional(),_meta:H(h(),ee()).optional()}),Zb=de.extend({method:k("roots/list"),params:Re.optional()}),ci=pe.extend({roots:j(jb)}),qb=Ce.extend({method:k("notifications/roots/list_changed"),params:Ie.optional()}),DE=W([Yn,Ys,Ib,ii,Vy,Dy,zy,Py,Ny,Iy,jy,Ur,si,Qn,to,ro,oo]),UE=W([Wn,Xn,Xs,qb,Lr]),FE=W([Kn,Vr,ai,Xt,ci,eo,no,Wt]),VE=W([Yn,pb,Eb,Zb,Qn,to,ro,oo]),BE=W([Wn,Xn,ob,qy,Ry,tb,Wy,Lr,Nb]),JE=W([Kn,yy,Cb,Ky,Uy,ky,Ey,Oy,so,Qy,eo,no,Wt]),N=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===C.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Bs(o.elicitations,r)}return new t(e,r,n)}},Bs=class extends N{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(C.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function mt(t){return t==="completed"||t==="failed"||t==="cancelled"}var zT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ui(t){let r=Fn(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=jd(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function li(t,e){let r=pt(t,e);if(!r.success)throw r.error;return r.data}var Vb=6e4,io=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Wn,r=>{this._oncancel(r)}),this.setNotificationHandler(Xn,r=>{this._onprogress(r)}),this.setRequestHandler(Yn,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Qn,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new N(C.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(to,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 N(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 N(C.InvalidParams,`Task not found: ${s}`);if(!mt(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(mt(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(ro,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 N(C.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(oo,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new N(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(mt(o.status))throw new N(C.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 N(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof N?o:new N(C.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),N.fromError(C.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){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=e;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)||xp(s)?this._onresponse(s):Gs(s)?this._onrequest(s,i):wp(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=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=N.fromError(C.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,s=e.params?._meta?.[ft]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:C.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(e.id,i);let a=bp(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new N(C.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.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:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:C.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(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.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(e)}`));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(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Cr(e))n(e);else{let i=new N(e.error.code,e.error.message,e.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(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Cr(e)&&e.result&&typeof e.result=="object"){let i=e.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(e))o(e);else{let i=N.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(i){yield{type:"error",error:i instanceof N?i:new N(C.InternalError,String(i))}}return}let s;try{let i=await this.request(e,Wt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new N(C.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},mt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new N(C.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new N(C.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 N?i:new N(C.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ft]:c}});let m=w=>{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(w)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let $=w instanceof N?w:new N(C.RequestTimeout,String(w));l($)};this._responseHandlers.set(p,w=>{if(!n?.signal?.aborted){if(w instanceof Error)return l(w);try{let $=pt(r,w.result);$.success?u($.data):l($.error)}catch($){l($)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let y=n?.timeout??Vb,g=()=>m(N.fromError(C.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(p,y,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let w=$=>{let S=this._responseHandlers.get(p);S?S($):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(p),l($)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},eo,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},no,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},kp,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ft]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,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={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ft]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=ui(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=li(e,o);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=ui(e);this._notificationHandlers.set(n,o=>{let s=li(e,o);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,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(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Gs(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new N(C.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new N(C.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new N(C.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new N(C.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=Lr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),mt(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 N(C.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(mt(a.status))throw new N(C.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=Lr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),mt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Rp(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ap(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];Rp(i)&&Rp(s)?r[o]={...i,...s}:r[o]=s}return r}var zh=Dt(Wa(),1),kh=Dt(Sh(),1);function HS(){let t=new zh.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,kh.default)(t),t}var Uo=class{constructor(e){this._ajv=e??HS()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Fo=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.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:e},Vr,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),o=e.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"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},Xt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Ph(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Eh(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Vo=class extends io{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Fr.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 Uo,this.setRequestHandler(Ys,n=>this._oninitialize(n)),this.setNotificationHandler(Xs,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(ii,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=Fr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Fo(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ap(this._capabilities,e)}setRequestHandler(e,r){let o=Fn(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(Gt(o)){let a=o;s=a._zod?.def?.value??a.value}else{let a=o;s=a._def?.value??a.value}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=pt(Ur,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new N(C.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=pt(Wt,p);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new N(C.InvalidParams,`Invalid task creation result: ${y}`)}return m.data}let f=pt(so,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new N(C.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;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 ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Eh(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Ph(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:gp.includes(r)?r:Js,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"},Kn)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.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 e.tools?this.request({method:"sampling/createMessage",params:e},ai,r):this.request({method:"sampling/createMessage",params:e},Vr,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},Xt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Xt,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new N(C.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof N?i:new N(C.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,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:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},ci,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var oc=Dt(require("node:process"),1);var Bo=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
79
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),GS(r)}clear(){this._buffer=void 0}};function GS(t){return Sp.parse(JSON.parse(t))}function Th(t){return JSON.stringify(t)+`
80
+ `}var Jo=class{constructor(e=oc.default.stdin,r=oc.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Bo,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}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 e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}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(e){return new Promise(r=>{let n=Th(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var rk=Dt(require("node:https")),nk=Dt(require("node:http")),hg=require("node:url"),gg=Dt(dg()),ce=class extends Error{constructor(r,n,o){super(r);this.status=n;this.body=o;this.name="ADTError"}status;body};var ok="http://www.sap.com/adt/programs/programs",sk="http://www.sap.com/adt/oo/classes",Mt="http://www.sap.com/adt/core",ik={DDLS:{path:"ddic/ddl/sources",ct:"application/vnd.sap.adt.ddlSource+xml",nsPrefix:"ddls",nsUri:"http://www.sap.com/adt/ddic/ddlsources",root:"ddlSource",nameInUrl:"upper",extraAttrs:""},BDEF:{path:"bo/behaviordefinitions",ct:"application/vnd.sap.adt.blues.v1+xml",nsPrefix:"blue",nsUri:"http://www.sap.com/wbobj/blue",root:"blueSource",nameInUrl:"lower",extraAttrs:""},SRVD:{path:"ddic/srvd/sources",ct:"application/vnd.sap.adt.ddic.srvd.v1+xml",nsPrefix:"srvd",nsUri:"http://www.sap.com/adt/ddic/srvdsources",root:"srvdSource",nameInUrl:"upper",extraAttrs:' srvd:srvdSourceType="S" adtcore:type="SRVD/SRV"'}},pg={ODATA_V4_UI:["ODATA","V4","1"],ODATA_V4_WEBAPI:["ODATA","V4","0"],ODATA_V2_UI:["ODATA","V2","1"],ODATA_V2_WEBAPI:["ODATA","V2","0"],INA:["INA","","0"],SQL:["SQL","","1"]},_g=new gg.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"@_",removeNSPrefix:!0,parseAttributeValue:!1,parseTagValue:!1,trimValues:!0}),Yo=class{constructor(e){this.settings=e;this.base=`${e.host.replace(/\/$/,"")}/sap/bc/adt`}settings;base;cookies=new Map;async request(e){let r=new hg.URL(this.base+e.path);for(let[c,u]of Object.entries(e.query||{}))r.searchParams.set(c,u);let n=r.protocol==="https:",s={Authorization:`Basic ${Buffer.from(`${this.settings.user}:${this.settings.password}`).toString("base64")}`,"sap-client":this.settings.client,"Accept-Language":this.settings.lang,...e.headers||{}};this.cookies.size>0&&(s.Cookie=[...this.cookies.entries()].map(([c,u])=>`${c}=${u}`).join("; "));let i=n?rk:nk,a={method:e.method||"GET",hostname:r.hostname,port:r.port||(n?443:80),path:r.pathname+r.search,headers:s,timeout:this.settings.timeoutMs};return n&&(a.rejectUnauthorized=this.settings.verifySsl),new Promise((c,u)=>{let l=i.request(a,d=>{let p=d.headers["set-cookie"];if(p)for(let m of p){let[y]=m.split(";"),g=y.indexOf("=");g>0&&this.cookies.set(y.slice(0,g).trim(),y.slice(g+1).trim())}let f=[];d.on("data",m=>f.push(m)),d.on("end",()=>c({status:d.statusCode||0,headers:d.headers,text:Buffer.concat(f).toString("utf-8")}))});l.on("error",u),l.on("timeout",()=>{l.destroy(new Error(`Request timed out after ${this.settings.timeoutMs}ms`))}),e.body&&l.write(e.body),l.end()})}async csrf(){let r=(await this.request({method:"GET",path:"/discovery",headers:{"x-csrf-token":"Fetch"}})).headers["x-csrf-token"];return typeof r=="string"?r:""}ensureOk(e,r){if(e.status>=400)throw new ce(`${r} failed: HTTP ${e.status}`,e.status,e.text.slice(0,2e3))}async testConnection(){try{let e=/^\d{1,3}$/.test(this.settings.client)?this.settings.client:"000",r=`SELECT MANDT, MTEXT FROM T000 WHERE MANDT = '${e}'`,n=await this.sqlQueryRaw(r,1),o=mg(n.text);return o.length>0?{status:"ok",client:o[0].MANDT||e,description:o[0].MTEXT||"",host:this.settings.host}:{status:"warning",message:`Connected, but client '${e}' was not found in T000. Verify the SAP_CLIENT setting.`,client:e,host:this.settings.host,diagnostic:{rawXml:n.text.slice(0,4e3),httpStatus:n.status}}}catch(e){let r=e;return{status:"error",message:r.message||String(e),diagnostic:{rawXml:r.body,httpStatus:r.status}}}}async sqlQueryRaw(e,r=100){if(!fg(e))throw new ce("Only SELECT statements are allowed.");let n=await this.csrf(),o=await this.request({method:"POST",path:"/datapreview/freestyle",query:{rowNumber:String(r)},headers:{Accept:"application/vnd.sap.adt.datapreview.table.v1+xml","Content-Type":"text/plain","x-csrf-token":n},body:e});return this.ensureOk(o,"SQL query"),o}async sqlQuery(e,r=100){if(!fg(e))throw new ce("Only SELECT statements are allowed via sqlQuery. Use the ABAP tools for write operations.");let n=await this.csrf(),o=await this.request({method:"POST",path:"/datapreview/freestyle",query:{rowNumber:String(r)},headers:{Accept:"application/vnd.sap.adt.datapreview.table.v1+xml","Content-Type":"text/plain","x-csrf-token":n},body:e});return this.ensureOk(o,"SQL query"),mg(o.text)}async readSource(e,r){let n=await this.request({method:"GET",path:Go(e,r),headers:{Accept:"text/plain"}});return this.ensureOk(n,`Read ${e} ${r}`),n.text}async searchObjects(e,r="",n=50){let o={operation:"quickSearch",query:e,maxResults:String(n)};r&&(o.objectType=r);let s=await this.request({method:"GET",path:"/repository/informationsystem/search",query:o,headers:{Accept:"application/xml"}});return this.ensureOk(s,"Object search"),ck(s.text)}async listPackage(e){let r=await this.csrf(),n=await this.request({method:"POST",path:"/repository/nodestructure",query:{parent_name:e,parent_tech_name:e},headers:{Accept:"application/vnd.sap.as+xml","x-csrf-token":r,"Content-Length":"0"},body:""});return this.ensureOk(n,`List package ${e}`),uk(n.text)}async tableInfo(e){let r=`SELECT FIELDNAME, KEYFLAG, ROLLNAME, DATATYPE, LENG, DECIMALS, POSITION FROM DD03L WHERE TABNAME = '${e.toUpperCase()}' AND AS4LOCAL = 'A' ORDER BY POSITION`,n=await this.sqlQuery(r,500);return{table:e.toUpperCase(),fields:n,field_count:n.length}}async syntaxCheck(e,r){let n=await this.csrf(),o=`/sap/bc/adt${Go(e,r)}`,s=`<?xml version="1.0" encoding="UTF-8"?><chkrun:checkObjectList xmlns:adtcore="${Mt}" xmlns:chkrun="http://www.sap.com/adt/checkrun"><chkrun:checkObject adtcore:uri="${o}" adtcore:version="active"/></chkrun:checkObjectList>`,i=await this.request({method:"POST",path:"/checkruns",query:{reporters:"abapCheckRun"},headers:{"Content-Type":"application/vnd.sap.adt.checkobjects+xml",Accept:"application/vnd.sap.adt.checkmessages+xml","x-csrf-token":n},body:s});return this.ensureOk(i,`Syntax check ${e} ${r}`),lk(i.text)}async createProgram(e,r,n="",o="$TMP",s=""){let i=await this.csrf(),a=`<?xml version="1.0" encoding="UTF-8"?><pgm:abapProgram xmlns:pgm="${ok}" xmlns:adtcore="${Mt}" adtcore:name="${e}" adtcore:type="PROG/P" adtcore:description="${Wo(n)}" pgm:lockedByEditor="false" pgm:programType="executableProgram"><adtcore:packageRef adtcore:name="${o}"/></pgm:abapProgram>`,c={};s&&(c.corrNr=s);let u=await this.request({method:"POST",path:"/programs/programs",query:c,headers:{"Content-Type":"application/vnd.sap.adt.programs.programs+xml","x-csrf-token":i},body:a});return this.ensureOk(u,`Create program ${e}`),this.putSource("PROG",e,r,s)}async deployProgram(e,r,n="",o="$TMP",s="",i=!0){let a=!1,c;try{await this.readSource("PROG",e),c=await this.putSource("PROG",e,r,s)}catch(u){if(u instanceof ce&&u.status===404)c=await this.createProgram(e,r,n,o,s),a=!0;else throw u}return c.created=a,i&&(c.activation=await this.activate("PROG",e)),c}async createClass(e,r,n="",o="$TMP",s=""){let i=await this.csrf(),a=`<?xml version="1.0" encoding="UTF-8"?><class:abapClass xmlns:class="${sk}" xmlns:adtcore="${Mt}" adtcore:name="${e}" adtcore:type="CLAS/OC" adtcore:description="${Wo(n)}" class:final="true" class:visibility="public"><adtcore:packageRef adtcore:name="${o}"/></class:abapClass>`,c={};s&&(c.corrNr=s);let u=await this.request({method:"POST",path:"/oo/classes",query:c,headers:{"Content-Type":"application/vnd.sap.adt.oo.classes.v3+xml","x-csrf-token":i},body:a});return this.ensureOk(u,`Create class ${e}`),this.putSource("CLAS",e,r,s)}async deployClass(e,r,n="",o="$TMP",s="",i=!0){let a=!1,c;try{await this.readSource("CLAS",e),c=await this.putSource("CLAS",e,r,s)}catch(u){if(u instanceof ce&&u.status===404)c=await this.createClass(e,r,n,o,s),a=!0;else throw u}return c.created=a,i&&(c.activation=await this.activate("CLAS",e)),c}async putSource(e,r,n,o=""){let s=await this.csrf(),i=await this.request({method:"GET",path:Go(e,r),headers:{"x-csrf-token":s}}),a=i.headers.etag||i.headers.etag||"",c={};o&&(c.corrNr=o);let u=await this.acquireLock(e,r,s);u&&(c.lockHandle=u);try{let l={"Content-Type":"text/plain; charset=utf-8",Accept:"text/plain","x-csrf-token":s};a&&(l["If-Match"]=a);let d=await this.request({method:"PUT",path:Go(e,r),query:c,headers:l,body:Buffer.from(n,"utf-8")});return this.ensureOk(d,`Upload source ${e} ${r}`),{ok:!0,status:d.status}}finally{u&&await this.releaseLock(e,r,s,u)}}async acquireLock(e,r,n){let o=await this.request({method:"POST",path:Ko(e,r),query:{_action:"LOCK",accessMode:"MODIFY"},headers:{"x-csrf-token":n,"X-sap-adt-sessiontype":"stateful",Accept:"application/vnd.sap.as+xml;dataname=com.sap.adt.lock.Result"}});if(o.status>=400)return null;let s=o.text.match(/<LOCK_HANDLE[^>]*>([^<]+)<\/LOCK_HANDLE>/i);return s?s[1]:null}async releaseLock(e,r,n,o){try{await this.request({method:"POST",path:Ko(e,r),query:{_action:"UNLOCK",lockHandle:o},headers:{"x-csrf-token":n,"X-sap-adt-sessiontype":"stateful"}})}catch{}}async activate(e,r){let n=await this.csrf(),o=`/sap/bc/adt${Ko(e,r)}`,s=`<?xml version="1.0" encoding="UTF-8"?><adtcore:objectReferences xmlns:adtcore="${Mt}"><adtcore:objectReference adtcore:uri="${o}" adtcore:name="${r}"/></adtcore:objectReferences>`,i=await this.request({method:"POST",path:"/activation",query:{method:"activate",preauditRequested:"true"},headers:{"Content-Type":"application/xml",Accept:"application/xml","x-csrf-token":n},body:s});return this.ensureOk(i,`Activate ${e} ${r}`),{ok:!i.text.includes("<chkl:messages")||!i.text.includes('type="E"'),status:i.status,body:i.text.slice(0,1500)}}async deleteObject(e,r,n=""){let o=await this.csrf(),s={};n&&(s.corrNr=n);let i=await this.acquireLock(e,r,o);i&&(s.lockHandle=i);try{let a=await this.request({method:"DELETE",path:Ko(e,r),query:s,headers:{"x-csrf-token":o,"X-sap-adt-sessiontype":"stateful"}});return a.status===404?{ok:!0,status:404,message:"Already absent"}:(this.ensureOk(a,`Delete ${e} ${r}`),{ok:!0,status:a.status})}finally{i&&await this.releaseLock(e,r,o,i)}}async createTable(e,r,n="",o="$TMP",s=!0){e=e.toUpperCase(),s&&!r.some(m=>m.name.toUpperCase()==="MANDT")&&(r=[{name:"MANDT",type:"CLNT",length:3,key:!0,rollname:"MANDT"},...r]);let i=n.slice(0,60).replaceAll("'","''"),a=o.replace(/'/g,"''"),c=["DATA: ls_dd02v TYPE dd02v,"," ls_dd09l TYPE dd09l,"," lt_dd03p TYPE STANDARD TABLE OF dd03p,"," ls_dd03p TYPE dd03p,"," ls_tadir TYPE tadir.","","ls_tadir-pgmid = 'R3TR'.","ls_tadir-object = 'TABL'.",`ls_tadir-obj_name = '${e}'.`,`ls_tadir-devclass = '${a}'.`,"ls_tadir-srcsystem = sy-sysid.","ls_tadir-author = sy-uname.","ls_tadir-masterlang = sy-langu.","MODIFY tadir FROM ls_tadir.","","",`ls_dd02v-tabname = '${e}'.`,"ls_dd02v-tabclass = 'TRANSP'.","ls_dd02v-mainflag = 'X'.","ls_dd02v-contflag = 'A'.","ls_dd02v-as4user = sy-uname.",`ls_dd02v-ddtext = '${i}'.`,"",`ls_dd09l-tabname = '${e}'.`,"ls_dd09l-as4user = sy-uname.","ls_dd09l-tabkat = '0'.","ls_dd09l-tabart = 'APPL0'.","ls_dd09l-bufallow = 'N'.","ls_dd09l-pufferung = ' '.","ls_dd09l-schfeldanz = '0'.","ls_dd09l-protokoll = ' '.",""];r.forEach((m,y)=>{let g=y+1,b=m.name.toUpperCase(),w=m.type.toUpperCase(),$=m.length,S=!!m.key,z=m.notnull??S,V=(m.rollname||"").toUpperCase(),ie=(m.ref_table||(m.ref_field?e:"")).toUpperCase(),at=(m.ref_field||"").toUpperCase(),Lt=(m.description||"").slice(0,60).replaceAll("'","''");c.push("CLEAR ls_dd03p."),c.push(`ls_dd03p-tabname = '${e}'.`),c.push(`ls_dd03p-fieldname = '${b}'.`),c.push(`ls_dd03p-position = '${String(g).padStart(4,"0")}'.`),S&&c.push("ls_dd03p-keyflag = 'X'."),z&&c.push("ls_dd03p-notnull = 'X'."),V&&c.push(`ls_dd03p-rollname = '${V}'.`),c.push(`ls_dd03p-datatype = '${w}'.`),c.push(`ls_dd03p-leng = '${String($).padStart(6,"0")}'.`),m.decimals!==void 0&&c.push(`ls_dd03p-decimals = '${String(m.decimals).padStart(6,"0")}'.`),at&&(c.push(`ls_dd03p-reftable = '${ie}'.`),c.push(`ls_dd03p-reffield = '${at}'.`)),Lt&&c.push(`ls_dd03p-ddtext = '${Lt}'.`),c.push("APPEND ls_dd03p TO lt_dd03p."),c.push("")}),c.push("CALL FUNCTION 'DDIF_TABL_PUT'",` EXPORTING name = '${e}'`," dd02v_wa = ls_dd02v"," dd09l_wa = ls_dd09l"," TABLES dd03p_tab = lt_dd03p"," EXCEPTIONS OTHERS = 99.","out->write( |PUT subrc=| && |{ sy-subrc }| ).","COMMIT WORK.");let u=c.join(`
81
+ `),l=await this.runAbap(u,120);if(!l.ok)return{ok:!1,step:"put",name:e,put:l};let d=await this.activate("TABL",e),p=`UPDATE dd02l SET as4local = 'A' WHERE tabname = '${e}'.
82
+ COMMIT WORK.
83
+ out->write( sy-dbcnt ).`,f=await this.runAbap(p);return{ok:d.ok===!0,name:e,put:l,activation:d,as4local_fix:f.output||""}}async deployDdls(e,r,n="",o="$TMP",s="",i=!0){return this.deployRap("DDLS",e,r,n,o,s,i)}async deployBdef(e,r,n="",o="$TMP",s="",i=!0){return this.deployRap("BDEF",e,r,n,o,s,i)}async deploySrvd(e,r,n="",o="$TMP",s="",i=!0){return this.deployRap("SRVD",e,r,n,o,s,i)}async deployRap(e,r,n,o,s,i,a){let c=ik[e];r=r.toUpperCase();let u=c.nameInUrl==="upper"?r:r.toLowerCase(),l=`/${c.path}`,d=`${l}/${u}`,p=`${d}/source/main`,f=await this.csrf(),m=await this.request({method:"GET",path:d,headers:{Accept:c.ct}}),y=m.status===200?"updated":"created";if(m.status!==200){let w=`<?xml version="1.0" encoding="UTF-8"?>
84
+ <${c.nsPrefix}:${c.root} xmlns:${c.nsPrefix}="${c.nsUri}" xmlns:adtcore="${Mt}" adtcore:name="${r}" adtcore:description="${Wo(o)}"${c.extraAttrs}><adtcore:packageRef adtcore:name="${s}"/></${c.nsPrefix}:${c.root}>`,$={};i&&($.corrNr=i);let S=await this.request({method:"POST",path:l,query:$,headers:{"Content-Type":c.ct,Accept:c.ct,"x-csrf-token":f},body:w});if(S.status!==200&&S.status!==201)throw new ce(`Create ${e} ${r} failed: HTTP ${S.status}`,S.status,S.text.slice(0,1500))}let g=await this.acquireLockUrl(d,f);if(!g)throw new ce(`Lock acquire failed for ${e} ${r}`);try{let w={lockHandle:g};i&&(w.corrNr=i);let $=await this.request({method:"PUT",path:p,query:w,headers:{"Content-Type":"text/plain; charset=utf-8","x-csrf-token":f},body:Buffer.from(n,"utf-8")});if($.status!==200&&$.status!==204)throw new ce(`Upload ${e} ${r} source failed: HTTP ${$.status}`,$.status,$.text.slice(0,1500))}finally{await this.releaseLockUrl(d,f,g)}let b={ok:!0,name:r,action:y,object_type:e};if(a){let w=await this.activateUrl(e,r,d);b.activation=w,b.ok=w.ok===!0}return b}async deploySrvb(e,r,n="",o="$TMP",s="ODATA_V4_UI",i="",a=!0){let c=pg[s.toUpperCase()];if(!c)throw new ce(`Unknown binding_type '${s}'. Choose from: ${Object.keys(pg).join(", ")}`);let[u,l,d]=c;e=e.toUpperCase(),r=r.toUpperCase();let p="/businessservices/bindings",f=`${p}/${e.toLowerCase()}`,m="application/vnd.sap.adt.businessservices.servicebinding.v2+xml",y=l?` srvb:version="${l}"`:"",g=`<?xml version="1.0" encoding="UTF-8"?>
85
+ <srvb:serviceBinding xmlns:srvb="http://www.sap.com/adt/ddic/ServiceBindings"
86
+ xmlns:adtcore="${Mt}"
87
+ srvb:contract="C2"
88
+ adtcore:name="${e}"
89
+ adtcore:description="${Wo(n)}"
90
+ adtcore:type="SRVB/SVB">
91
+ <adtcore:packageRef adtcore:name="${o}"/>
92
+ <srvb:services srvb:name="${e}">
93
+ <srvb:content srvb:version="0001" srvb:releaseState="NOT_RELEASED">
94
+ <srvb:serviceDefinition adtcore:uri="/sap/bc/adt/ddic/srvd/sources/${r.toLowerCase()}" adtcore:type="SRVD/SRV" adtcore:name="${r}"/>
95
+ </srvb:content>
96
+ </srvb:services>
97
+ <srvb:binding srvb:type="${u}"${y} srvb:category="${d}">
98
+ <srvb:implementation adtcore:name="${e}"/>
99
+ </srvb:binding>
100
+ </srvb:serviceBinding>`,b=await this.csrf(),w=await this.request({method:"GET",path:f,headers:{Accept:m}}),$=w.status===200?"updated":"created",S={};if(i&&(S.corrNr=i),w.status===200){let V=await this.acquireLockUrl(f,b);if(!V)throw new ce(`Lock failed for SRVB ${e}`);try{S.lockHandle=V;let ie=await this.request({method:"PUT",path:f,query:S,headers:{"Content-Type":m,Accept:m,"x-csrf-token":b},body:g});if(ie.status!==200&&ie.status!==204)throw new ce(`Update SRVB ${e} failed: HTTP ${ie.status}`,ie.status,ie.text.slice(0,1500))}finally{await this.releaseLockUrl(f,b,V)}}else{let V=await this.request({method:"POST",path:p,query:S,headers:{"Content-Type":m,Accept:m,"x-csrf-token":b},body:g});if(V.status!==200&&V.status!==201)throw new ce(`Create SRVB ${e} failed: HTTP ${V.status}`,V.status,V.text.slice(0,1500))}let z={ok:!0,name:e,action:$,binding_type:s.toUpperCase(),object_type:"SRVB",note:"Activated but not published \u2014 publish from Eclipse / VS Code ADT."};if(a){let V=await this.activateUrl("SRVB",e,f);z.activation=V,z.ok=V.ok===!0}return z}async acquireLockUrl(e,r){let n=await this.request({method:"POST",path:e,query:{_action:"LOCK",accessMode:"MODIFY"},headers:{"x-csrf-token":r,"X-sap-adt-sessiontype":"stateful",Accept:"application/vnd.sap.as+xml;dataname=com.sap.adt.lock.Result"}});if(n.status>=400)return null;let o=n.text.match(/<LOCK_HANDLE[^>]*>([^<]+)<\/LOCK_HANDLE>/i);return o?o[1]:null}async releaseLockUrl(e,r,n){try{await this.request({method:"POST",path:e,query:{_action:"UNLOCK",lockHandle:n},headers:{"x-csrf-token":r,"X-sap-adt-sessiontype":"stateful"}})}catch{}}async activateUrl(e,r,n){let o=await this.csrf(),s=`/sap/bc/adt${n}`,i=`<?xml version="1.0" encoding="UTF-8"?><adtcore:objectReferences xmlns:adtcore="${Mt}"><adtcore:objectReference adtcore:uri="${s}" adtcore:name="${r}"/></adtcore:objectReferences>`,a=await this.request({method:"POST",path:"/activation",query:{method:"activate",preauditRequested:"true"},headers:{"Content-Type":"application/xml",Accept:"application/xml","x-csrf-token":o},body:i});if(a.status>=400)throw new ce(`Activate ${e} ${r} failed: HTTP ${a.status}`,a.status,a.text.slice(0,1500));return{ok:!a.text.includes("<chkl:messages")||!a.text.includes('type="E"'),status:a.status,body:a.text.slice(0,1500)}}async runAbap(e,r=60){let o=`ZCL_MCP_RUN_${String(Date.now()).slice(-7)}`,s=e.split(`
101
+ `).map(a=>a.trim()?" "+a:a).join(`
102
+ `),i=`CLASS ${o} DEFINITION PUBLIC FINAL CREATE PUBLIC.
103
+ PUBLIC SECTION.
104
+ INTERFACES if_oo_adt_classrun.
105
+ ENDCLASS.
106
+ CLASS ${o} IMPLEMENTATION.
107
+ METHOD if_oo_adt_classrun~main.
108
+ TRY.
109
+ ${s}
110
+ CATCH cx_root INTO DATA(lx).
111
+ out->write( |ERROR: { lx->get_text( ) }| ).
112
+ ENDTRY.
113
+ ENDMETHOD.
114
+ ENDCLASS.`;try{await this.deployClass(o,i,"Transient classrun");let a=await this.classrun(o,r*1e3);return{ok:!a.startsWith("[HTTP")&&!a.includes("Error:"),output:a.trim()}}finally{try{await this.deleteObject("CLAS",o)}catch{}}}async classrun(e,r){this.cookies.clear();let n=await this.request({method:"GET",path:"/datapreview/freestyle",headers:{"x-csrf-token":"Fetch",Accept:"application/vnd.sap.adt.datapreview.table.v1+xml"}}),o=n.headers["x-csrf-token"]||n.headers["X-CSRF-Token"]||"",s=this.settings.timeoutMs;this.settings.timeoutMs=Math.max(r,s);try{let i=await this.request({method:"POST",path:`/oo/classrun/${e.toUpperCase()}`,headers:{Accept:"text/plain","x-csrf-token":o}});return i.status>=400?`[HTTP ${i.status}] ${i.text.slice(0,1e3)}`:i.text}finally{this.settings.timeoutMs=s}}};function Go(t,e){let r=t.toUpperCase(),n=encodeURIComponent(e);switch(r){case"PROG":return`/programs/programs/${n}/source/main`;case"CLAS":return`/oo/classes/${n}/source/main`;case"INTF":return`/oo/interfaces/${n}/source/main`;case"FUGR":return`/functions/groups/${n}/source/main`;case"DDLS":return`/ddic/ddl/sources/${n}/source/main`;default:throw new ce(`Unsupported object type for source: ${t}`)}}function Ko(t,e){let r=t.toUpperCase(),n=encodeURIComponent(e);switch(r){case"PROG":return`/programs/programs/${n}`;case"CLAS":return`/oo/classes/${n}`;case"INTF":return`/oo/interfaces/${n}`;case"FUGR":return`/functions/groups/${n}`;case"DDLS":return`/ddic/ddl/sources/${n}`;case"TABL":return`/ddic/tables/${n}`;case"TRAN":return`/transactions/${n}`;default:throw new ce(`Unsupported object type: ${t}`)}}function Wo(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function fg(t){let e=t.trim().replace(/^\(+/,"").trimStart().toUpperCase();if(!e.startsWith("SELECT")&&!e.startsWith("WITH"))return!1;let r=["INSERT ","UPDATE ","DELETE ","MODIFY ","DROP ","ALTER ","TRUNCATE ","CREATE "],n=t.toUpperCase();return!r.some(o=>n.includes(o))}function mg(t){let e=_g.parse(t),n=(e.tableData??e).columns;if(!n)return[];let o=Array.isArray(n)?n:[n],s=[];for(let c of o){let u=c.metadata,l=ak(u,"name"),p=c.dataSet?.data,m=(p===void 0?[]:Array.isArray(p)?p:[p]).map(y=>typeof y=="string"?y:y==null?"":String(y));s.push({name:l,values:m})}if(s.length===0)return[];let i=Math.max(0,...s.map(c=>c.values.length)),a=[];for(let c=0;c<i;c++){let u={};for(let{name:l,values:d}of s)l&&(u[l]=d[c]??"");a.push(u)}return a}function ak(t,e){if(!t)return"";for(let r of Object.keys(t))if(r===`@_${e}`||r.endsWith(`:${e}`)||r===e){let n=t[r];if(typeof n=="string")return n;if(n!=null)return String(n)}return""}function ck(t){let r=_g.parse(t).objectReferences?.objectReference;return r?(Array.isArray(r)?r:[r]).map(o=>({name:o["@_name"]||"",type:o["@_type"]||"",description:o["@_description"]||"",package:o["@_packageName"]||"",uri:o["@_uri"]||""})):[]}function uk(t){let e=[],r=/<SEU_ADT_REPOSITORY_OBJ_NODE>([\s\S]*?)<\/SEU_ADT_REPOSITORY_OBJ_NODE>/g,n;for(;(n=r.exec(t))!==null;){let o=n[1],s=a=>{let c=new RegExp(`<${a}>([^<]*)</${a}>`).exec(o);return c?c[1]:""},i=s("OBJECT_NAME");i&&e.push({name:i,type:s("OBJECT_TYPE"),tech_name:s("TECH_NAME"),uri:s("OBJECT_URI"),description:s("DESCRIPTION")})}return e}function lk(t){let e=[],r=/<\w*:?checkMessage\b([^/]*?)\/>/gi,n;for(;(n=r.exec(t))!==null;){let i=n[1];e.push({type:/\btype="([^"]+)"/.exec(i)?.[1]||"",text:/\bshortText="([^"]+)"/.exec(i)?.[1]||"",line:parseInt(/\bline="([^"]+)"/.exec(i)?.[1]||"0",10),uri:/\buri="([^"]+)"/.exec(i)?.[1]||""})}let o=e.filter(i=>i.type==="E"),s=e.filter(i=>i.type==="W");return{ok:o.length===0,errors:o,warnings:s,messages:e}}function dk(){let t=(process.env.SAP_HOST||"").trim(),e=(process.env.SAP_USER||"").trim(),r=process.env.SAP_PASSWORD||"",n=[];return t||n.push("SAP_HOST"),e||n.push("SAP_USER"),r||n.push("SAP_PASSWORD"),n.length>0&&(process.stderr.write(`sap-abap-mcp: missing environment variables: ${n.join(", ")}
115
+ `),process.exit(2)),{host:t,client:(process.env.SAP_CLIENT||"100").trim(),user:e,password:r,lang:(process.env.SAP_LANG||"EN").trim(),verifySsl:process.env.SAP_VERIFY_SSL==="true",readonly:process.env.SAP_READONLY==="true",timeoutMs:parseInt(process.env.SAP_TIMEOUT||"30",10)*1e3}}var pk=[{name:"sap_ping",description:"Test the ADT connection to the configured SAP system. Returns client (mandant) and description from T000.",inputSchema:{type:"object",properties:{}}},{name:"sap_sql",description:"Run an ABAP-SQL SELECT against any table. Only SELECT is allowed. Supports WHERE, JOIN, GROUP BY, ORDER BY, UP TO N ROWS.",inputSchema:{type:"object",required:["sql"],properties:{sql:{type:"string",description:"ABAP SQL SELECT statement"},max_rows:{type:"integer",default:100,minimum:1,maximum:1e4}}}},{name:"sap_table_info",description:"Return DDIC structure of a table: field names, data types, key flags, lengths.",inputSchema:{type:"object",required:["table"],properties:{table:{type:"string",description:"DDIC table name"}}}},{name:"sap_read_object",description:"Read the source of an ABAP object. object_type: PROG (report), CLAS (class), INTF (interface), FUGR (function group), DDLS (CDS view).",inputSchema:{type:"object",required:["object_type","name"],properties:{object_type:{type:"string",enum:["PROG","CLAS","INTF","FUGR","DDLS"]},name:{type:"string"}}}},{name:"sap_search_objects",description:"Search the repository by name / fragment. Returns matching objects with type and package.",inputSchema:{type:"object",required:["query"],properties:{query:{type:"string",description:"Search term, may contain * wildcards"},object_type:{type:"string",description:"Optional ADT object type filter, e.g. CLAS/OC, PROG/P, TABL/DT"},max_results:{type:"integer",default:50,minimum:1,maximum:500}}}},{name:"sap_list_package",description:"List all objects inside an ABAP package (DEVC/K).",inputSchema:{type:"object",required:["package"],properties:{package:{type:"string",description:"Package name, e.g. $TMP"}}}},{name:"sap_syntax_check",description:"Run an ADT syntax/semantic check on an existing object. Returns errors and warnings.",inputSchema:{type:"object",required:["object_type","name"],properties:{object_type:{type:"string",enum:["PROG","CLAS","INTF","FUGR","DDLS"]},name:{type:"string"}}}}],fk=[{name:"sap_deploy_program",description:"Create or update an ABAP report. Idempotent: creates if absent, updates if present. Activates by default.",inputSchema:{type:"object",required:["name","source"],properties:{name:{type:"string",description:"Report name, must start with Z or Y"},source:{type:"string",description:"Full ABAP source"},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},transport:{type:"string"},activate:{type:"boolean",default:!0}}}},{name:"sap_deploy_class",description:"Create or update an ABAP class. Source must include the full CLASS DEFINITION and IMPLEMENTATION.",inputSchema:{type:"object",required:["name","source"],properties:{name:{type:"string",description:"Class name, must start with Z or Y"},source:{type:"string",description:"Full ABAP class source"},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},transport:{type:"string"},activate:{type:"boolean",default:!0}}}},{name:"sap_activate",description:"Activate one ABAP object.",inputSchema:{type:"object",required:["object_type","name"],properties:{object_type:{type:"string",enum:["PROG","CLAS","INTF","FUGR","DDLS","TABL"]},name:{type:"string"}}}},{name:"sap_delete_object",description:"Delete an ABAP object. Use with care.",inputSchema:{type:"object",required:["object_type","name"],properties:{object_type:{type:"string",enum:["PROG","CLAS","INTF","FUGR","DDLS","TABL","TRAN"]},name:{type:"string"},transport:{type:"string"}}}},{name:"sap_create_table",description:"Create or update a DDIC transparent table via DDIF_TABL_PUT and activate it. Auto-prepends MANDT for client-dependent tables.",inputSchema:{type:"object",required:["name","fields"],properties:{name:{type:"string",description:"Table name (Z*/Y*)"},fields:{type:"array",description:"Column definitions",items:{type:"object",required:["name","type","length"],properties:{name:{type:"string"},type:{type:"string",description:"CHAR | NUMC | DATS | TIMS | DEC | CURR | QUAN | CUKY | UNIT | CLNT | INT4 | RAW | ..."},length:{type:"integer",minimum:1},key:{type:"boolean",default:!1},notnull:{type:"boolean"},decimals:{type:"integer",minimum:0},rollname:{type:"string"},ref_table:{type:"string"},ref_field:{type:"string"},description:{type:"string"}}}},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},client_dependent:{type:"boolean",default:!0}}}},{name:"sap_deploy_ddls",description:"Create or update a CDS view (DDLS). Idempotent. Source must be a full DEFINE [ROOT] VIEW [ENTITY] block.",inputSchema:{type:"object",required:["name","source"],properties:{name:{type:"string"},source:{type:"string"},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},transport:{type:"string"},activate:{type:"boolean",default:!0}}}},{name:"sap_deploy_bdef",description:"Create or update a Behavior Definition (BDEF) for RAP \u2014 actions, validations, determinations on a CDS root entity.",inputSchema:{type:"object",required:["name","source"],properties:{name:{type:"string"},source:{type:"string"},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},transport:{type:"string"},activate:{type:"boolean",default:!0}}}},{name:"sap_deploy_srvd",description:"Create or update a Service Definition (SRVD) for RAP \u2014 declares which entities are exposed via OData.",inputSchema:{type:"object",required:["name","source"],properties:{name:{type:"string"},source:{type:"string"},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},transport:{type:"string"},activate:{type:"boolean",default:!0}}}},{name:"sap_deploy_srvb",description:"Create or update a Service Binding (SRVB) for RAP. NOTE: the final 'Publish' step requires a workbench transport and is not automated \u2014 finish in Eclipse / VS Code ADT.",inputSchema:{type:"object",required:["name","srvd_name"],properties:{name:{type:"string"},srvd_name:{type:"string",description:"Active SRVD to bind"},description:{type:"string",default:""},package:{type:"string",default:"$TMP"},binding_type:{type:"string",enum:["ODATA_V4_UI","ODATA_V4_WEBAPI","ODATA_V2_UI","ODATA_V2_WEBAPI","INA","SQL"],default:"ODATA_V4_UI"},transport:{type:"string"},activate:{type:"boolean",default:!0}}}},{name:"sap_run_abap",description:"Run an ABAP snippet via if_oo_adt_classrun. The snippet runs inside METHOD if_oo_adt_classrun~main; use out->write( ) for output. A transient class is created, executed, and deleted.",inputSchema:{type:"object",required:["snippet"],properties:{snippet:{type:"string",description:"ABAP statements"},timeout:{type:"integer",default:60,minimum:5,maximum:600}}}}];async function mk(t,e,r,n){switch(r){case"sap_ping":return t.testConnection();case"sap_sql":return t.sqlQuery(String(n.sql),Number(n.max_rows??100));case"sap_table_info":return t.tableInfo(String(n.table));case"sap_read_object":{let o=await t.readSource(String(n.object_type),String(n.name));return{object_type:n.object_type,name:n.name,lines:o.split(`
116
+ `).length,source:o}}case"sap_search_objects":return t.searchObjects(String(n.query),String(n.object_type??""),Number(n.max_results??50));case"sap_list_package":return t.listPackage(String(n.package));case"sap_syntax_check":return t.syntaxCheck(String(n.object_type),String(n.name))}if(e.readonly)return{ok:!1,error:`Tool '${r}' is a write operation but the server is in read-only mode.`};switch(r){case"sap_deploy_program":return t.deployProgram(String(n.name),String(n.source),String(n.description??""),String(n.package??"$TMP"),String(n.transport??""),n.activate!==!1);case"sap_deploy_class":return t.deployClass(String(n.name),String(n.source),String(n.description??""),String(n.package??"$TMP"),String(n.transport??""),n.activate!==!1);case"sap_activate":return t.activate(String(n.object_type),String(n.name));case"sap_delete_object":return t.deleteObject(String(n.object_type),String(n.name),String(n.transport??""));case"sap_create_table":return t.createTable(String(n.name),n.fields.map(o=>({name:String(o.name),type:String(o.type),length:Number(o.length),key:!!o.key,notnull:o.notnull===void 0?void 0:!!o.notnull,decimals:o.decimals===void 0?void 0:Number(o.decimals),rollname:o.rollname?String(o.rollname):void 0,ref_table:o.ref_table?String(o.ref_table):void 0,ref_field:o.ref_field?String(o.ref_field):void 0,description:o.description?String(o.description):void 0})),String(n.description??""),String(n.package??"$TMP"),n.client_dependent!==!1);case"sap_deploy_ddls":return t.deployDdls(String(n.name),String(n.source),String(n.description??""),String(n.package??"$TMP"),String(n.transport??""),n.activate!==!1);case"sap_deploy_bdef":return t.deployBdef(String(n.name),String(n.source),String(n.description??""),String(n.package??"$TMP"),String(n.transport??""),n.activate!==!1);case"sap_deploy_srvd":return t.deploySrvd(String(n.name),String(n.source),String(n.description??""),String(n.package??"$TMP"),String(n.transport??""),n.activate!==!1);case"sap_deploy_srvb":return t.deploySrvb(String(n.name),String(n.srvd_name),String(n.description??""),String(n.package??"$TMP"),String(n.binding_type??"ODATA_V4_UI"),String(n.transport??""),n.activate!==!1);case"sap_run_abap":{let o=n.snippet;return typeof o!="string"||!o.trim()?{ok:!1,error:"sap_run_abap requires parameter 'snippet' (ABAP statements). Got: "+(o===void 0?"undefined":JSON.stringify(o))}:t.runAbap(o,Number(n.timeout??60))}}return{ok:!1,error:`Unknown tool: ${r}`}}async function hk(){let t=dk(),e=new Yo(t),r=new Vo({name:"sap-abap-mcp",version:"0.1.0"},{capabilities:{tools:{}}});r.setRequestHandler(si,async()=>{let o=[...pk];return t.readonly||o.push(...fk),{tools:o}}),r.setRequestHandler(Ur,async o=>{let{name:s,arguments:i}=o.params,a;try{a=await mk(e,t,s,i||{})}catch(c){c instanceof ce?a={ok:!1,error:c.message,status:c.status,body:c.body}:a={ok:!1,error:`${c instanceof Error?c.name:"Error"}: ${c instanceof Error?c.message:String(c)}`}}return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}});let n=new Jo;await r.connect(n)}hk().catch(t=>{process.stderr.write(`sap-abap-mcp fatal: ${t instanceof Error?t.message:String(t)}
117
+ `),process.exit(1)});