UNPKG

somod-http-extension

Version:

SOMOD middleware to intercept and validate Lambda event for AWS APIGateway

5 lines 2.72 MB
var jy=Object.create;var c2=Object.defineProperty;var Uy=Object.getOwnPropertyDescriptor;var By=Object.getOwnPropertyNames;var zy=Object.getPrototypeOf,Hy=Object.prototype.hasOwnProperty;var V=(e,a)=>()=>(a||e((a={exports:{}}).exports,a),a.exports),Gy=(e,a)=>{for(var r in a)c2(e,r,{get:a[r],enumerable:!0})},Vu=(e,a,r,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of By(a))!Hy.call(e,n)&&n!==r&&c2(e,n,{get:()=>a[n],enumerable:!(i=Uy(a,n))||i.enumerable});return e};var _t=(e,a,r)=>(r=e!=null?jy(zy(e)):{},Vu(a||!e||!e.__esModule?c2(r,"default",{value:e,enumerable:!0}):r,e)),Wy=e=>Vu(c2({},"__esModule",{value:!0}),e);var gi=V(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.regexpCode=De.getEsmExportName=De.getProperty=De.safeStringify=De.stringify=De.strConcat=De.addCodeArg=De.str=De._=De.nil=De._Code=De.Name=De.IDENTIFIER=De._CodeOrName=void 0;var hn=class{};De._CodeOrName=hn;De.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var vi=class extends hn{constructor(a){if(super(),!De.IDENTIFIER.test(a))throw new Error("CodeGen: name must be a valid identifier");this.str=a}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};De.Name=vi;var Pa=class extends hn{constructor(a){super(),this._items=typeof a=="string"?[a]:a}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let a=this._items[0];return a===""||a==='""'}get str(){var a;return(a=this._str)!==null&&a!==void 0?a:this._str=this._items.reduce((r,i)=>`${r}${i}`,"")}get names(){var a;return(a=this._names)!==null&&a!==void 0?a:this._names=this._items.reduce((r,i)=>(i instanceof vi&&(r[i.str]=(r[i.str]||0)+1),r),{})}};De._Code=Pa;De.nil=new Pa("");function ku(e,...a){let r=[e[0]],i=0;for(;i<a.length;)Xs(r,a[i]),r.push(e[++i]);return new Pa(r)}De._=ku;var Zs=new Pa("+");function ju(e,...a){let r=[vn(e[0])],i=0;for(;i<a.length;)r.push(Zs),Xs(r,a[i]),r.push(Zs,vn(e[++i]));return Ky(r),new Pa(r)}De.str=ju;function Xs(e,a){a instanceof Pa?e.push(...a._items):a instanceof vi?e.push(a):e.push(Zy(a))}De.addCodeArg=Xs;function Ky(e){let a=1;for(;a<e.length-1;){if(e[a]===Zs){let r=Yy(e[a-1],e[a+1]);if(r!==void 0){e.splice(a-1,3,r);continue}e[a++]="+"}a++}}function Yy(e,a){if(a==='""')return e;if(e==='""')return a;if(typeof e=="string")return a instanceof vi||e[e.length-1]!=='"'?void 0:typeof a!="string"?`${e.slice(0,-1)}${a}"`:a[0]==='"'?e.slice(0,-1)+a.slice(1):void 0;if(typeof a=="string"&&a[0]==='"'&&!(e instanceof vi))return`"${e}${a.slice(1)}`}function Jy(e,a){return a.emptyStr()?e:e.emptyStr()?a:ju`${e}${a}`}De.strConcat=Jy;function Zy(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:vn(Array.isArray(e)?e.join(","):e)}function Xy(e){return new Pa(vn(e))}De.stringify=Xy;function vn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}De.safeStringify=vn;function Qy(e){return typeof e=="string"&&De.IDENTIFIER.test(e)?new Pa(`.${e}`):ku`[${e}]`}De.getProperty=Qy;function eS(e){if(typeof e=="string"&&De.IDENTIFIER.test(e))return new Pa(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}De.getEsmExportName=eS;function aS(e){return new Pa(e.toString())}De.regexpCode=aS});var w2=V(z1=>{"use strict";Object.defineProperty(z1,"__esModule",{value:!0});z1.ValueScope=z1.ValueScopeName=z1.Scope=z1.varKinds=z1.UsedValueState=void 0;var ea=gi(),Qs=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`),this.value=a.value}},eo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(eo=z1.UsedValueState||(z1.UsedValueState={}));z1.varKinds={const:new ea.Name("const"),let:new ea.Name("let"),var:new ea.Name("var")};var g2=class{constructor({prefixes:a,parent:r}={}){this._names={},this._prefixes=a,this._parent=r}toName(a){return a instanceof ea.Name?a:this.name(a)}name(a){return new ea.Name(this._newName(a))}_newName(a){let r=this._names[a]||this._nameGroup(a);return`${a}${r.index++}`}_nameGroup(a){var r,i;if(((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0?void 0:i.has(a))||this._prefixes&&!this._prefixes.has(a))throw new Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};z1.Scope=g2;var _2=class extends ea.Name{constructor(a,r){super(r),this.prefix=a}setValue(a,{property:r,itemIndex:i}){this.value=a,this.scopePath=(0,ea._)`.${new ea.Name(r)}[${i}]`}};z1.ValueScopeName=_2;var rS=(0,ea._)`\n`,ao=class extends g2{constructor(a){super(a),this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?rS:ea.nil}}get(){return this._scope}name(a){return new _2(a,this._newName(a))}value(a,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(a),{prefix:s}=n,o=(i=r.key)!==null&&i!==void 0?i:r.ref,l=this._values[s];if(l){let g=l.get(o);if(g)return g}else l=this._values[s]=new Map;l.set(o,n);let m=this._scope[s]||(this._scope[s]=[]),c=m.length;return m[c]=r.ref,n.setValue(r,{property:s,itemIndex:c}),n}getValue(a,r){let i=this._values[a];if(!!i)return i.get(r)}scopeRefs(a,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,ea._)`${a}${i.scopePath}`})}scopeCode(a=this._values,r,i){return this._reduceValues(a,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(a,r,i={},n){let s=ea.nil;for(let o in a){let l=a[o];if(!l)continue;let m=i[o]=i[o]||new Map;l.forEach(c=>{if(m.has(c))return;m.set(c,eo.Started);let g=r(c);if(g){let _=this.opts.es5?z1.varKinds.var:z1.varKinds.const;s=(0,ea._)`${s}${_} ${c} = ${g};${this.opts._n}`}else if(g=n?.(c))s=(0,ea._)`${s}${g}${this.opts._n}`;else throw new Qs(c);m.set(c,eo.Completed)})}return s}};z1.ValueScope=ao});var me=V(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.or=ve.and=ve.not=ve.CodeGen=ve.operators=ve.varKinds=ve.ValueScopeName=ve.ValueScope=ve.Scope=ve.Name=ve.regexpCode=ve.stringify=ve.getProperty=ve.nil=ve.strConcat=ve.str=ve._=void 0;var $e=gi(),Wa=w2(),wt=gi();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return wt._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return wt.str}});Object.defineProperty(ve,"strConcat",{enumerable:!0,get:function(){return wt.strConcat}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return wt.nil}});Object.defineProperty(ve,"getProperty",{enumerable:!0,get:function(){return wt.getProperty}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return wt.stringify}});Object.defineProperty(ve,"regexpCode",{enumerable:!0,get:function(){return wt.regexpCode}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return wt.Name}});var E2=w2();Object.defineProperty(ve,"Scope",{enumerable:!0,get:function(){return E2.Scope}});Object.defineProperty(ve,"ValueScope",{enumerable:!0,get:function(){return E2.ValueScope}});Object.defineProperty(ve,"ValueScopeName",{enumerable:!0,get:function(){return E2.ValueScopeName}});Object.defineProperty(ve,"varKinds",{enumerable:!0,get:function(){return E2.varKinds}});ve.operators={GT:new $e._Code(">"),GTE:new $e._Code(">="),LT:new $e._Code("<"),LTE:new $e._Code("<="),EQ:new $e._Code("==="),NEQ:new $e._Code("!=="),NOT:new $e._Code("!"),OR:new $e._Code("||"),AND:new $e._Code("&&"),ADD:new $e._Code("+")};var Ur=class{optimizeNodes(){return this}optimizeNames(a,r){return this}},ro=class extends Ur{constructor(a,r,i){super(),this.varKind=a,this.name=r,this.rhs=i}render({es5:a,_n:r}){let i=a?Wa.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(a,r){if(!!a[this.name.str])return this.rhs&&(this.rhs=rp(this.rhs,a,r)),this}get names(){return this.rhs instanceof $e._CodeOrName?this.rhs.names:{}}},y2=class extends Ur{constructor(a,r,i){super(),this.lhs=a,this.rhs=r,this.sideEffects=i}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,r){if(!(this.lhs instanceof $e.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=rp(this.rhs,a,r),this}get names(){let a=this.lhs instanceof $e.Name?{}:{...this.lhs.names};return b2(a,this.rhs)}},to=class extends y2{constructor(a,r,i,n){super(a,i,n),this.op=r}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}},io=class extends Ur{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}},po=class extends Ur{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}},no=class extends Ur{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}},so=class extends Ur{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,r){return this.code=rp(this.code,a,r),this}get names(){return this.code instanceof $e._CodeOrName?this.code.names:{}}},gn=class extends Ur{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((r,i)=>r+i.render(a),"")}optimizeNodes(){let{nodes:a}=this,r=a.length;for(;r--;){let i=a[r].optimizeNodes();Array.isArray(i)?a.splice(r,1,...i):i?a[r]=i:a.splice(r,1)}return a.length>0?this:void 0}optimizeNames(a,r){let{nodes:i}=this,n=i.length;for(;n--;){let s=i[n];s.optimizeNames(a,r)||(tS(a,s.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((a,r)=>wi(a,r.names),{})}},Br=class extends gn{render(a){return"{"+a._n+super.render(a)+"}"+a._n}},oo=class extends gn{},ap=class extends Br{};ap.kind="else";var Ka=class extends Br{constructor(a,r){super(r),this.condition=a}render(a){let r=`if(${this.condition})`+super.render(a);return this.else&&(r+="else "+this.else.render(a)),r}optimizeNodes(){super.optimizeNodes();let a=this.condition;if(a===!0)return this.nodes;let r=this.else;if(r){let i=r.optimizeNodes();r=this.else=Array.isArray(i)?new ap(i):i}if(r)return a===!1?r instanceof Ka?r:r.nodes:this.nodes.length?this:new Ka(Uu(a),r instanceof Ka?[r]:r.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(a,r),!!(super.optimizeNames(a,r)||this.else))return this.condition=rp(this.condition,a,r),this}get names(){let a=super.names;return b2(a,this.condition),this.else&&wi(a,this.else.names),a}};Ka.kind="if";var _i=class extends Br{};_i.kind="for";var lo=class extends _i{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,r){if(!!super.optimizeNames(a,r))return this.iteration=rp(this.iteration,a,r),this}get names(){return wi(super.names,this.iteration.names)}},uo=class extends _i{constructor(a,r,i,n){super(),this.varKind=a,this.name=r,this.from=i,this.to=n}render(a){let r=a.es5?Wa.varKinds.var:this.varKind,{name:i,from:n,to:s}=this;return`for(${r} ${i}=${n}; ${i}<${s}; ${i}++)`+super.render(a)}get names(){let a=b2(super.names,this.from);return b2(a,this.to)}},S2=class extends _i{constructor(a,r,i,n){super(),this.loop=a,this.varKind=r,this.name=i,this.iterable=n}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,r){if(!!super.optimizeNames(a,r))return this.iterable=rp(this.iterable,a,r),this}get names(){return wi(super.names,this.iterable.names)}},_n=class extends Br{constructor(a,r,i){super(),this.name=a,this.args=r,this.async=i}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}};_n.kind="func";var wn=class extends gn{render(a){return"return "+super.render(a)}};wn.kind="return";var mo=class extends Br{render(a){let r="try"+super.render(a);return this.catch&&(r+=this.catch.render(a)),this.finally&&(r+=this.finally.render(a)),r}optimizeNodes(){var a,r;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(a,r){var i,n;return super.optimizeNames(a,r),(i=this.catch)===null||i===void 0||i.optimizeNames(a,r),(n=this.finally)===null||n===void 0||n.optimizeNames(a,r),this}get names(){let a=super.names;return this.catch&&wi(a,this.catch.names),this.finally&&wi(a,this.finally.names),a}},yn=class extends Br{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}};yn.kind="catch";var Sn=class extends Br{render(a){return"finally"+super.render(a)}};Sn.kind="finally";var fo=class{constructor(a,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` `:""},this._extScope=a,this._scope=new Wa.Scope({parent:a}),this._nodes=[new oo]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,r){let i=this._extScope.value(a,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(a,r){return this._extScope.getValue(a,r)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,r,i,n){let s=this._scope.toName(r);return i!==void 0&&n&&(this._constants[s.str]=i),this._leafNode(new ro(a,s,i)),s}const(a,r,i){return this._def(Wa.varKinds.const,a,r,i)}let(a,r,i){return this._def(Wa.varKinds.let,a,r,i)}var(a,r,i){return this._def(Wa.varKinds.var,a,r,i)}assign(a,r,i){return this._leafNode(new y2(a,r,i))}add(a,r){return this._leafNode(new to(a,ve.operators.ADD,r))}code(a){return typeof a=="function"?a():a!==$e.nil&&this._leafNode(new so(a)),this}object(...a){let r=["{"];for(let[i,n]of a)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,$e.addCodeArg)(r,n));return r.push("}"),new $e._Code(r)}if(a,r,i){if(this._blockNode(new Ka(a)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new Ka(a))}else(){return this._elseNode(new ap)}endIf(){return this._endBlockNode(Ka,ap)}_for(a,r){return this._blockNode(a),r&&this.code(r).endFor(),this}for(a,r){return this._for(new lo(a),r)}forRange(a,r,i,n,s=this.opts.es5?Wa.varKinds.var:Wa.varKinds.let){let o=this._scope.toName(a);return this._for(new uo(s,o,r,i),()=>n(o))}forOf(a,r,i,n=Wa.varKinds.const){let s=this._scope.toName(a);if(this.opts.es5){let o=r instanceof $e.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,$e._)`${o}.length`,l=>{this.var(s,(0,$e._)`${o}[${l}]`),i(s)})}return this._for(new S2("of",n,s,r),()=>i(s))}forIn(a,r,i,n=this.opts.es5?Wa.varKinds.var:Wa.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,$e._)`Object.keys(${r})`,i);let s=this._scope.toName(a);return this._for(new S2("in",n,s,r),()=>i(s))}endFor(){return this._endBlockNode(_i)}label(a){return this._leafNode(new io(a))}break(a){return this._leafNode(new po(a))}return(a){let r=new wn;if(this._blockNode(r),this.code(a),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(wn)}try(a,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new mo;if(this._blockNode(n),this.code(a),r){let s=this.name("e");this._currNode=n.catch=new yn(s),r(s)}return i&&(this._currNode=n.finally=new Sn,this.code(i)),this._endBlockNode(yn,Sn)}throw(a){return this._leafNode(new no(a))}block(a,r){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(r),this}endBlock(a){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-r;if(i<0||a!==void 0&&i!==a)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${a} expected`);return this._nodes.length=r,this}func(a,r=$e.nil,i,n){return this._blockNode(new _n(a,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(_n)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,r){let i=this._currNode;if(i instanceof a||r&&i instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${a.kind}/${r.kind}`:a.kind}"`)}_elseNode(a){let r=this._currNode;if(!(r instanceof Ka))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=a,this}get _root(){return this._nodes[0]}get _currNode(){let a=this._nodes;return a[a.length-1]}set _currNode(a){let r=this._nodes;r[r.length-1]=a}};ve.CodeGen=fo;function wi(e,a){for(let r in a)e[r]=(e[r]||0)+(a[r]||0);return e}function b2(e,a){return a instanceof $e._CodeOrName?wi(e,a.names):e}function rp(e,a,r){if(e instanceof $e.Name)return i(e);if(!n(e))return e;return new $e._Code(e._items.reduce((s,o)=>(o instanceof $e.Name&&(o=i(o)),o instanceof $e._Code?s.push(...o._items):s.push(o),s),[]));function i(s){let o=r[s.str];return o===void 0||a[s.str]!==1?s:(delete a[s.str],o)}function n(s){return s instanceof $e._Code&&s._items.some(o=>o instanceof $e.Name&&a[o.str]===1&&r[o.str]!==void 0)}}function tS(e,a){for(let r in a)e[r]=(e[r]||0)-(a[r]||0)}function Uu(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,$e._)`!${co(e)}`}ve.not=Uu;var iS=Bu(ve.operators.AND);function pS(...e){return e.reduce(iS)}ve.and=pS;var nS=Bu(ve.operators.OR);function dS(...e){return e.reduce(nS)}ve.or=dS;function Bu(e){return(a,r)=>a===$e.nil?r:r===$e.nil?a:(0,$e._)`${co(a)} ${e} ${co(r)}`}function co(e){return e instanceof $e.Name?e:(0,$e._)`(${e})`}});var Oe=V(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.checkStrictMode=ge.getErrorPath=ge.Type=ge.useFunc=ge.setEvaluated=ge.evaluatedPropsToName=ge.mergeEvaluated=ge.eachItem=ge.unescapeJsonPointer=ge.escapeJsonPointer=ge.escapeFragment=ge.unescapeFragment=ge.schemaRefOrVal=ge.schemaHasRulesButRef=ge.schemaHasRules=ge.checkUnknownRules=ge.alwaysValidSchema=ge.toHash=void 0;var ke=me(),sS=gi();function oS(e){let a={};for(let r of e)a[r]=!0;return a}ge.toHash=oS;function lS(e,a){return typeof a=="boolean"?a:Object.keys(a).length===0?!0:(Gu(e,a),!Wu(a,e.self.RULES.all))}ge.alwaysValidSchema=lS;function Gu(e,a=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema||typeof a=="boolean")return;let n=i.RULES.keywords;for(let s in a)n[s]||Zu(e,`unknown keyword: "${s}"`)}ge.checkUnknownRules=Gu;function Wu(e,a){if(typeof e=="boolean")return!e;for(let r in e)if(a[r])return!0;return!1}ge.schemaHasRules=Wu;function uS(e,a){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&a.all[r])return!0;return!1}ge.schemaHasRulesButRef=uS;function mS({topSchemaRef:e,schemaPath:a},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ke._)`${r}`}return(0,ke._)`${e}${a}${(0,ke.getProperty)(i)}`}ge.schemaRefOrVal=mS;function fS(e){return Ku(decodeURIComponent(e))}ge.unescapeFragment=fS;function cS(e){return encodeURIComponent(ho(e))}ge.escapeFragment=cS;function ho(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}ge.escapeJsonPointer=ho;function Ku(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}ge.unescapeJsonPointer=Ku;function hS(e,a){if(Array.isArray(e))for(let r of e)a(r);else a(e)}ge.eachItem=hS;function zu({mergeNames:e,mergeToName:a,mergeValues:r,resultToName:i}){return(n,s,o,l)=>{let m=o===void 0?s:o instanceof ke.Name?(s instanceof ke.Name?e(n,s,o):a(n,s,o),o):s instanceof ke.Name?(a(n,o,s),s):r(s,o);return l===ke.Name&&!(m instanceof ke.Name)?i(n,m):m}}ge.mergeEvaluated={props:zu({mergeNames:(e,a,r)=>e.if((0,ke._)`${r} !== true && ${a} !== undefined`,()=>{e.if((0,ke._)`${a} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ke._)`${r} || {}`).code((0,ke._)`Object.assign(${r}, ${a})`))}),mergeToName:(e,a,r)=>e.if((0,ke._)`${r} !== true`,()=>{a===!0?e.assign(r,!0):(e.assign(r,(0,ke._)`${r} || {}`),vo(e,r,a))}),mergeValues:(e,a)=>e===!0?!0:{...e,...a},resultToName:Yu}),items:zu({mergeNames:(e,a,r)=>e.if((0,ke._)`${r} !== true && ${a} !== undefined`,()=>e.assign(r,(0,ke._)`${a} === true ? true : ${r} > ${a} ? ${r} : ${a}`)),mergeToName:(e,a,r)=>e.if((0,ke._)`${r} !== true`,()=>e.assign(r,a===!0?!0:(0,ke._)`${r} > ${a} ? ${r} : ${a}`)),mergeValues:(e,a)=>e===!0?!0:Math.max(e,a),resultToName:(e,a)=>e.var("items",a)})};function Yu(e,a){if(a===!0)return e.var("props",!0);let r=e.var("props",(0,ke._)`{}`);return a!==void 0&&vo(e,r,a),r}ge.evaluatedPropsToName=Yu;function vo(e,a,r){Object.keys(r).forEach(i=>e.assign((0,ke._)`${a}${(0,ke.getProperty)(i)}`,!0))}ge.setEvaluated=vo;var Hu={};function vS(e,a){return e.scopeValue("func",{ref:a,code:Hu[a.code]||(Hu[a.code]=new sS._Code(a.code))})}ge.useFunc=vS;var Ju;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ju=ge.Type||(ge.Type={}));function gS(e,a,r){if(e instanceof ke.Name){let i=a===Ju.Num;return r?i?(0,ke._)`"[" + ${e} + "]"`:(0,ke._)`"['" + ${e} + "']"`:i?(0,ke._)`"/" + ${e}`:(0,ke._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ke.getProperty)(e).toString():"/"+ho(e)}ge.getErrorPath=gS;function Zu(e,a,r=e.opts.strictSchema){if(!!r){if(a=`strict mode: ${a}`,r===!0)throw new Error(a);e.self.logger.warn(a)}}ge.checkStrictMode=Zu});var lr=V(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var R1=me(),_S={data:new R1.Name("data"),valCxt:new R1.Name("valCxt"),instancePath:new R1.Name("instancePath"),parentData:new R1.Name("parentData"),parentDataProperty:new R1.Name("parentDataProperty"),rootData:new R1.Name("rootData"),dynamicAnchors:new R1.Name("dynamicAnchors"),vErrors:new R1.Name("vErrors"),errors:new R1.Name("errors"),this:new R1.Name("this"),self:new R1.Name("self"),scope:new R1.Name("scope"),json:new R1.Name("json"),jsonPos:new R1.Name("jsonPos"),jsonLen:new R1.Name("jsonLen"),jsonPart:new R1.Name("jsonPart")};go.default=_S});var tp=V(I1=>{"use strict";Object.defineProperty(I1,"__esModule",{value:!0});I1.extendErrors=I1.resetErrorsCount=I1.reportExtraError=I1.reportError=I1.keyword$DataError=I1.keywordError=void 0;var Te=me(),N2=Oe(),H1=lr();I1.keywordError={message:({keyword:e})=>(0,Te.str)`must pass "${e}" keyword validation`};I1.keyword$DataError={message:({keyword:e,schemaType:a})=>a?(0,Te.str)`"${e}" keyword must be ${a} ($data)`:(0,Te.str)`"${e}" keyword is invalid ($data)`};function wS(e,a=I1.keywordError,r,i){let{it:n}=e,{gen:s,compositeRule:o,allErrors:l}=n,m=e3(e,a,r);i??(o||l)?Xu(s,m):Qu(n,(0,Te._)`[${m}]`)}I1.reportError=wS;function yS(e,a=I1.keywordError,r){let{it:i}=e,{gen:n,compositeRule:s,allErrors:o}=i,l=e3(e,a,r);Xu(n,l),s||o||Qu(i,H1.default.vErrors)}I1.reportExtraError=yS;function SS(e,a){e.assign(H1.default.errors,a),e.if((0,Te._)`${H1.default.vErrors} !== null`,()=>e.if(a,()=>e.assign((0,Te._)`${H1.default.vErrors}.length`,a),()=>e.assign(H1.default.vErrors,null)))}I1.resetErrorsCount=SS;function bS({gen:e,keyword:a,schemaValue:r,data:i,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let o=e.name("err");e.forRange("i",n,H1.default.errors,l=>{e.const(o,(0,Te._)`${H1.default.vErrors}[${l}]`),e.if((0,Te._)`${o}.instancePath === undefined`,()=>e.assign((0,Te._)`${o}.instancePath`,(0,Te.strConcat)(H1.default.instancePath,s.errorPath))),e.assign((0,Te._)`${o}.schemaPath`,(0,Te.str)`${s.errSchemaPath}/${a}`),s.opts.verbose&&(e.assign((0,Te._)`${o}.schema`,r),e.assign((0,Te._)`${o}.data`,i))})}I1.extendErrors=bS;function Xu(e,a){let r=e.const("err",a);e.if((0,Te._)`${H1.default.vErrors} === null`,()=>e.assign(H1.default.vErrors,(0,Te._)`[${r}]`),(0,Te._)`${H1.default.vErrors}.push(${r})`),e.code((0,Te._)`${H1.default.errors}++`)}function Qu(e,a){let{gen:r,validateName:i,schemaEnv:n}=e;n.$async?r.throw((0,Te._)`new ${e.ValidationError}(${a})`):(r.assign((0,Te._)`${i}.errors`,a),r.return(!1))}var yi={keyword:new Te.Name("keyword"),schemaPath:new Te.Name("schemaPath"),params:new Te.Name("params"),propertyName:new Te.Name("propertyName"),message:new Te.Name("message"),schema:new Te.Name("schema"),parentSchema:new Te.Name("parentSchema")};function e3(e,a,r){let{createErrors:i}=e.it;return i===!1?(0,Te._)`{}`:ES(e,a,r)}function ES(e,a,r={}){let{gen:i,it:n}=e,s=[NS(n,r),$S(e,r)];return TS(e,a,s),i.object(...s)}function NS({errorPath:e},{instancePath:a}){let r=a?(0,Te.str)`${e}${(0,N2.getErrorPath)(a,N2.Type.Str)}`:e;return[H1.default.instancePath,(0,Te.strConcat)(H1.default.instancePath,r)]}function $S({keyword:e,it:{errSchemaPath:a}},{schemaPath:r,parentSchema:i}){let n=i?a:(0,Te.str)`${a}/${e}`;return r&&(n=(0,Te.str)`${n}${(0,N2.getErrorPath)(r,N2.Type.Str)}`),[yi.schemaPath,n]}function TS(e,{params:a,message:r},i){let{keyword:n,data:s,schemaValue:o,it:l}=e,{opts:m,propertyName:c,topSchemaRef:g,schemaPath:_}=l;i.push([yi.keyword,n],[yi.params,typeof a=="function"?a(e):a||(0,Te._)`{}`]),m.messages&&i.push([yi.message,typeof r=="function"?r(e):r]),m.verbose&&i.push([yi.schema,o],[yi.parentSchema,(0,Te._)`${g}${_}`],[H1.default.data,s]),c&&i.push([yi.propertyName,c])}});var r3=V(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.boolOrEmptySchema=ip.topBoolOrEmptySchema=void 0;var AS=tp(),DS=me(),OS=lr(),CS={message:"boolean schema is false"};function xS(e){let{gen:a,schema:r,validateName:i}=e;r===!1?a3(e,!1):typeof r=="object"&&r.$async===!0?a.return(OS.default.data):(a.assign((0,DS._)`${i}.errors`,null),a.return(!0))}ip.topBoolOrEmptySchema=xS;function PS(e,a){let{gen:r,schema:i}=e;i===!1?(r.var(a,!1),a3(e)):r.var(a,!0)}ip.boolOrEmptySchema=PS;function a3(e,a){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,AS.reportError)(n,CS,void 0,a)}});var _o=V(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});pp.getRules=pp.isJSONType=void 0;var RS=["string","number","integer","boolean","null","object","array"],IS=new Set(RS);function VS(e){return typeof e=="string"&&IS.has(e)}pp.isJSONType=VS;function FS(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}pp.getRules=FS});var wo=V(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.shouldUseRule=yt.shouldUseGroup=yt.schemaHasRulesForType=void 0;function LS({schema:e,self:a},r){let i=a.RULES.types[r];return i&&i!==!0&&t3(e,i)}yt.schemaHasRulesForType=LS;function t3(e,a){return a.rules.some(r=>i3(e,r))}yt.shouldUseGroup=t3;function i3(e,a){var r;return e[a.keyword]!==void 0||((r=a.definition.implements)===null||r===void 0?void 0:r.some(i=>e[i]!==void 0))}yt.shouldUseRule=i3});var En=V(N1=>{"use strict";Object.defineProperty(N1,"__esModule",{value:!0});N1.reportTypeError=N1.checkDataTypes=N1.checkDataType=N1.coerceAndCheckDataType=N1.getJSONTypes=N1.getSchemaTypes=N1.DataType=void 0;var qS=_o(),MS=wo(),kS=tp(),fe=me(),p3=Oe(),bn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(bn=N1.DataType||(N1.DataType={}));function jS(e){let a=n3(e.type);if(a.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!a.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&a.push("null")}return a}N1.getSchemaTypes=jS;function n3(e){let a=Array.isArray(e)?e:e?[e]:[];if(a.every(qS.isJSONType))return a;throw new Error("type must be JSONType or JSONType[]: "+a.join(","))}N1.getJSONTypes=n3;function US(e,a){let{gen:r,data:i,opts:n}=e,s=BS(a,n.coerceTypes),o=a.length>0&&!(s.length===0&&a.length===1&&(0,MS.schemaHasRulesForType)(e,a[0]));if(o){let l=So(a,i,n.strictNumbers,bn.Wrong);r.if(l,()=>{s.length?zS(e,a,s):bo(e)})}return o}N1.coerceAndCheckDataType=US;var d3=new Set(["string","number","integer","boolean","null"]);function BS(e,a){return a?e.filter(r=>d3.has(r)||a==="array"&&r==="array"):[]}function zS(e,a,r){let{gen:i,data:n,opts:s}=e,o=i.let("dataType",(0,fe._)`typeof ${n}`),l=i.let("coerced",(0,fe._)`undefined`);s.coerceTypes==="array"&&i.if((0,fe._)`${o} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,fe._)`${n}[0]`).assign(o,(0,fe._)`typeof ${n}`).if(So(a,n,s.strictNumbers),()=>i.assign(l,n))),i.if((0,fe._)`${l} !== undefined`);for(let c of r)(d3.has(c)||c==="array"&&s.coerceTypes==="array")&&m(c);i.else(),bo(e),i.endIf(),i.if((0,fe._)`${l} !== undefined`,()=>{i.assign(n,l),HS(e,l)});function m(c){switch(c){case"string":i.elseIf((0,fe._)`${o} == "number" || ${o} == "boolean"`).assign(l,(0,fe._)`"" + ${n}`).elseIf((0,fe._)`${n} === null`).assign(l,(0,fe._)`""`);return;case"number":i.elseIf((0,fe._)`${o} == "boolean" || ${n} === null || (${o} == "string" && ${n} && ${n} == +${n})`).assign(l,(0,fe._)`+${n}`);return;case"integer":i.elseIf((0,fe._)`${o} === "boolean" || ${n} === null || (${o} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(l,(0,fe._)`+${n}`);return;case"boolean":i.elseIf((0,fe._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(l,!1).elseIf((0,fe._)`${n} === "true" || ${n} === 1`).assign(l,!0);return;case"null":i.elseIf((0,fe._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(l,null);return;case"array":i.elseIf((0,fe._)`${o} === "string" || ${o} === "number" || ${o} === "boolean" || ${n} === null`).assign(l,(0,fe._)`[${n}]`)}}}function HS({gen:e,parentData:a,parentDataProperty:r},i){e.if((0,fe._)`${a} !== undefined`,()=>e.assign((0,fe._)`${a}[${r}]`,i))}function yo(e,a,r,i=bn.Correct){let n=i===bn.Correct?fe.operators.EQ:fe.operators.NEQ,s;switch(e){case"null":return(0,fe._)`${a} ${n} null`;case"array":s=(0,fe._)`Array.isArray(${a})`;break;case"object":s=(0,fe._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":s=o((0,fe._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":s=o();break;default:return(0,fe._)`typeof ${a} ${n} ${e}`}return i===bn.Correct?s:(0,fe.not)(s);function o(l=fe.nil){return(0,fe.and)((0,fe._)`typeof ${a} == "number"`,l,r?(0,fe._)`isFinite(${a})`:fe.nil)}}N1.checkDataType=yo;function So(e,a,r,i){if(e.length===1)return yo(e[0],a,r,i);let n,s=(0,p3.toHash)(e);if(s.array&&s.object){let o=(0,fe._)`typeof ${a} != "object"`;n=s.null?o:(0,fe._)`!${a} || ${o}`,delete s.null,delete s.array,delete s.object}else n=fe.nil;s.number&&delete s.integer;for(let o in s)n=(0,fe.and)(n,yo(o,a,r,i));return n}N1.checkDataTypes=So;var GS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:a})=>typeof e=="string"?(0,fe._)`{type: ${e}}`:(0,fe._)`{type: ${a}}`};function bo(e){let a=WS(e);(0,kS.reportError)(a,GS)}N1.reportTypeError=bo;function WS(e){let{gen:a,data:r,schema:i}=e,n=(0,p3.schemaRefOrVal)(e,i,"type");return{gen:a,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var o3=V($2=>{"use strict";Object.defineProperty($2,"__esModule",{value:!0});$2.assignDefaults=void 0;var np=me(),KS=Oe();function YS(e,a){let{properties:r,items:i}=e.schema;if(a==="object"&&r)for(let n in r)s3(e,n,r[n].default);else a==="array"&&Array.isArray(i)&&i.forEach((n,s)=>s3(e,s,n.default))}$2.assignDefaults=YS;function s3(e,a,r){let{gen:i,compositeRule:n,data:s,opts:o}=e;if(r===void 0)return;let l=(0,np._)`${s}${(0,np.getProperty)(a)}`;if(n){(0,KS.checkStrictMode)(e,`default is ignored for: ${l}`);return}let m=(0,np._)`${l} === undefined`;o.useDefaults==="empty"&&(m=(0,np._)`${m} || ${l} === null || ${l} === ""`),i.if(m,(0,np._)`${l} = ${(0,np.stringify)(r)}`)}});var Ra=V(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.validateUnion=Le.validateArray=Le.usePattern=Le.callValidateCode=Le.schemaProperties=Le.allSchemaProperties=Le.noPropertyInData=Le.propertyInData=Le.isOwnProperty=Le.hasPropFunc=Le.reportMissingProp=Le.checkMissingProp=Le.checkReportMissingProp=void 0;var Ke=me(),Eo=Oe(),St=lr(),JS=Oe();function ZS(e,a){let{gen:r,data:i,it:n}=e;r.if($o(r,i,a,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Ke._)`${a}`},!0),e.error()})}Le.checkReportMissingProp=ZS;function XS({gen:e,data:a,it:{opts:r}},i,n){return(0,Ke.or)(...i.map(s=>(0,Ke.and)($o(e,a,s,r.ownProperties),(0,Ke._)`${n} = ${s}`)))}Le.checkMissingProp=XS;function QS(e,a){e.setParams({missingProperty:a},!0),e.error()}Le.reportMissingProp=QS;function l3(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ke._)`Object.prototype.hasOwnProperty`})}Le.hasPropFunc=l3;function No(e,a,r){return(0,Ke._)`${l3(e)}.call(${a}, ${r})`}Le.isOwnProperty=No;function eb(e,a,r,i){let n=(0,Ke._)`${a}${(0,Ke.getProperty)(r)} !== undefined`;return i?(0,Ke._)`${n} && ${No(e,a,r)}`:n}Le.propertyInData=eb;function $o(e,a,r,i){let n=(0,Ke._)`${a}${(0,Ke.getProperty)(r)} === undefined`;return i?(0,Ke.or)(n,(0,Ke.not)(No(e,a,r))):n}Le.noPropertyInData=$o;function u3(e){return e?Object.keys(e).filter(a=>a!=="__proto__"):[]}Le.allSchemaProperties=u3;function ab(e,a){return u3(a).filter(r=>!(0,Eo.alwaysValidSchema)(e,a[r]))}Le.schemaProperties=ab;function rb({schemaCode:e,data:a,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:s},it:o},l,m,c){let g=c?(0,Ke._)`${e}, ${a}, ${i}${n}`:a,_=[[St.default.instancePath,(0,Ke.strConcat)(St.default.instancePath,s)],[St.default.parentData,o.parentData],[St.default.parentDataProperty,o.parentDataProperty],[St.default.rootData,St.default.rootData]];o.opts.dynamicRef&&_.push([St.default.dynamicAnchors,St.default.dynamicAnchors]);let b=(0,Ke._)`${g}, ${r.object(..._)}`;return m!==Ke.nil?(0,Ke._)`${l}.call(${m}, ${b})`:(0,Ke._)`${l}(${b})`}Le.callValidateCode=rb;var tb=(0,Ke._)`new RegExp`;function ib({gen:e,it:{opts:a}},r){let i=a.unicodeRegExp?"u":"",{regExp:n}=a.code,s=n(r,i);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Ke._)`${n.code==="new RegExp"?tb:(0,JS.useFunc)(e,n)}(${r}, ${i})`})}Le.usePattern=ib;function pb(e){let{gen:a,data:r,keyword:i,it:n}=e,s=a.name("valid");if(n.allErrors){let l=a.let("valid",!0);return o(()=>a.assign(l,!1)),l}return a.var(s,!0),o(()=>a.break()),s;function o(l){let m=a.const("len",(0,Ke._)`${r}.length`);a.forRange("i",0,m,c=>{e.subschema({keyword:i,dataProp:c,dataPropType:Eo.Type.Num},s),a.if((0,Ke.not)(s),l)})}}Le.validateArray=pb;function nb(e){let{gen:a,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(m=>(0,Eo.alwaysValidSchema)(n,m))&&!n.opts.unevaluated)return;let o=a.let("valid",!1),l=a.name("_valid");a.block(()=>r.forEach((m,c)=>{let g=e.subschema({keyword:i,schemaProp:c,compositeRule:!0},l);a.assign(o,(0,Ke._)`${o} || ${l}`),e.mergeValidEvaluated(g,l)||a.if((0,Ke.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Le.validateUnion=nb});var c3=V(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.validateKeywordUsage=ur.validSchemaType=ur.funcKeywordCode=ur.macroKeywordCode=void 0;var G1=me(),Si=lr(),db=Ra(),sb=tp();function ob(e,a){let{gen:r,keyword:i,schema:n,parentSchema:s,it:o}=e,l=a.macro.call(o.self,n,s,o),m=f3(r,i,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);let c=r.name("valid");e.subschema({schema:l,schemaPath:G1.nil,errSchemaPath:`${o.errSchemaPath}/${i}`,topSchemaRef:m,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}ur.macroKeywordCode=ob;function lb(e,a){var r;let{gen:i,keyword:n,schema:s,parentSchema:o,$data:l,it:m}=e;mb(m,a);let c=!l&&a.compile?a.compile.call(m.self,s,o,m):a.validate,g=f3(i,n,c),_=i.let("valid");e.block$data(_,b),e.ok((r=a.valid)!==null&&r!==void 0?r:_);function b(){if(a.errors===!1)T(),a.modifying&&m3(e),C(()=>e.error());else{let I=a.async?S():E();a.modifying&&m3(e),C(()=>ub(e,I))}}function S(){let I=i.let("ruleErrs",null);return i.try(()=>T((0,G1._)`await `),M=>i.assign(_,!1).if((0,G1._)`${M} instanceof ${m.ValidationError}`,()=>i.assign(I,(0,G1._)`${M}.errors`),()=>i.throw(M))),I}function E(){let I=(0,G1._)`${g}.errors`;return i.assign(I,null),T(G1.nil),I}function T(I=a.async?(0,G1._)`await `:G1.nil){let M=m.opts.passContext?Si.default.this:Si.default.self,B=!("compile"in a&&!l||a.schema===!1);i.assign(_,(0,G1._)`${I}${(0,db.callValidateCode)(e,g,M,B)}`,a.modifying)}function C(I){var M;i.if((0,G1.not)((M=a.valid)!==null&&M!==void 0?M:_),I)}}ur.funcKeywordCode=lb;function m3(e){let{gen:a,data:r,it:i}=e;a.if(i.parentData,()=>a.assign(r,(0,G1._)`${i.parentData}[${i.parentDataProperty}]`))}function ub(e,a){let{gen:r}=e;r.if((0,G1._)`Array.isArray(${a})`,()=>{r.assign(Si.default.vErrors,(0,G1._)`${Si.default.vErrors} === null ? ${a} : ${Si.default.vErrors}.concat(${a})`).assign(Si.default.errors,(0,G1._)`${Si.default.vErrors}.length`),(0,sb.extendErrors)(e)},()=>e.error())}function mb({schemaEnv:e},a){if(a.async&&!e.$async)throw new Error("async keyword in sync schema")}function f3(e,a,r){if(r===void 0)throw new Error(`keyword "${a}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,G1.stringify)(r)})}function fb(e,a,r=!1){return!a.length||a.some(i=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}ur.validSchemaType=fb;function cb({schema:e,opts:a,self:r,errSchemaPath:i},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let o=n.dependencies;if(o?.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let m=`keyword "${s}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(a.validateSchema==="log")r.logger.error(m);else throw new Error(m)}}ur.validateKeywordUsage=cb});var v3=V(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.extendSubschemaMode=bt.extendSubschemaData=bt.getSubschema=void 0;var mr=me(),h3=Oe();function hb(e,{keyword:a,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:s,topSchemaRef:o}){if(a!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let l=e.schema[a];return r===void 0?{schema:l,schemaPath:(0,mr._)`${e.schemaPath}${(0,mr.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${a}`}:{schema:l[r],schemaPath:(0,mr._)`${e.schemaPath}${(0,mr.getProperty)(a)}${(0,mr.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${a}/${(0,h3.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}bt.getSubschema=hb;function vb(e,a,{dataProp:r,dataPropType:i,data:n,dataTypes:s,propertyName:o}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:l}=a;if(r!==void 0){let{errorPath:c,dataPathArr:g,opts:_}=a,b=l.let("data",(0,mr._)`${a.data}${(0,mr.getProperty)(r)}`,!0);m(b),e.errorPath=(0,mr.str)`${c}${(0,h3.getErrorPath)(r,i,_.jsPropertySyntax)}`,e.parentDataProperty=(0,mr._)`${r}`,e.dataPathArr=[...g,e.parentDataProperty]}if(n!==void 0){let c=n instanceof mr.Name?n:l.let("data",n,!0);m(c),o!==void 0&&(e.propertyName=o)}s&&(e.dataTypes=s);function m(c){e.data=c,e.dataLevel=a.dataLevel+1,e.dataTypes=[],a.definedProperties=new Set,e.parentData=a.data,e.dataNames=[...a.dataNames,c]}}bt.extendSubschemaData=vb;function gb(e,{jtdDiscriminator:a,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:s}){i!==void 0&&(e.compositeRule=i),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=a,e.jtdMetadata=r}bt.extendSubschemaMode=gb});var To=V((Gx,g3)=>{"use strict";g3.exports=function e(a,r){if(a===r)return!0;if(a&&r&&typeof a=="object"&&typeof r=="object"){if(a.constructor!==r.constructor)return!1;var i,n,s;if(Array.isArray(a)){if(i=a.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(a[n],r[n]))return!1;return!0}if(a.constructor===RegExp)return a.source===r.source&&a.flags===r.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===r.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===r.toString();if(s=Object.keys(a),i=s.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=i;n--!==0;){var o=s[n];if(!e(a[o],r[o]))return!1}return!0}return a!==a&&r!==r}});var w3=V((Wx,_3)=>{"use strict";var Et=_3.exports=function(e,a,r){typeof a=="function"&&(r=a,a={}),r=a.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};T2(a,i,n,e,"",e)};Et.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Et.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Et.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Et.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 T2(e,a,r,i,n,s,o,l,m,c){if(i&&typeof i=="object"&&!Array.isArray(i)){a(i,n,s,o,l,m,c);for(var g in i){var _=i[g];if(Array.isArray(_)){if(g in Et.arrayKeywords)for(var b=0;b<_.length;b++)T2(e,a,r,_[b],n+"/"+g+"/"+b,s,n,g,i,b)}else if(g in Et.propsKeywords){if(_&&typeof _=="object")for(var S in _)T2(e,a,r,_[S],n+"/"+g+"/"+_b(S),s,n,g,i,S)}else(g in Et.keywords||e.allKeys&&!(g in Et.skipKeywords))&&T2(e,a,r,_,n+"/"+g,s,n,g,i)}r(i,n,s,o,l,m,c)}}function _b(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Nn=V(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.getSchemaRefs=aa.resolveUrl=aa.normalizeId=aa._getFullPath=aa.getFullPath=aa.inlineRef=void 0;var wb=Oe(),yb=To(),Sb=w3(),bb=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Eb(e,a=!0){return typeof e=="boolean"?!0:a===!0?!Ao(e):a?y3(e)<=a:!1}aa.inlineRef=Eb;var Nb=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ao(e){for(let a in e){if(Nb.has(a))return!0;let r=e[a];if(Array.isArray(r)&&r.some(Ao)||typeof r=="object"&&Ao(r))return!0}return!1}function y3(e){let a=0;for(let r in e){if(r==="$ref")return 1/0;if(a++,!bb.has(r)&&(typeof e[r]=="object"&&(0,wb.eachItem)(e[r],i=>a+=y3(i)),a===1/0))return 1/0}return a}function S3(e,a="",r){r!==!1&&(a=dp(a));let i=e.parse(a);return b3(e,i)}aa.getFullPath=S3;function b3(e,a){return e.serialize(a).split("#")[0]+"#"}aa._getFullPath=b3;var $b=/#\/?$/;function dp(e){return e?e.replace($b,""):""}aa.normalizeId=dp;function Tb(e,a,r){return r=dp(r),e.resolve(a,r)}aa.resolveUrl=Tb;var Ab=/^[a-z_][-a-z0-9._]*$/i;function Db(e,a){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=dp(e[r]||a),s={"":n},o=S3(i,n,!1),l={},m=new Set;return Sb(e,{allKeys:!0},(_,b,S,E)=>{if(E===void 0)return;let T=o+b,C=s[E];typeof _[r]=="string"&&(C=I.call(this,_[r])),M.call(this,_.$anchor),M.call(this,_.$dynamicAnchor),s[b]=C;function I(B){let Y=this.opts.uriResolver.resolve;if(B=dp(C?Y(C,B):B),m.has(B))throw g(B);m.add(B);let U=this.refs[B];return typeof U=="string"&&(U=this.refs[U]),typeof U=="object"?c(_,U.schema,B):B!==dp(T)&&(B[0]==="#"?(c(_,l[B],B),l[B]=_):this.refs[B]=T),B}function M(B){if(typeof B=="string"){if(!Ab.test(B))throw new Error(`invalid anchor "${B}"`);I.call(this,`#${B}`)}}}),l;function c(_,b,S){if(b!==void 0&&!yb(_,b))throw g(S)}function g(_){return new Error(`reference "${_}" resolves to more than one schema`)}}aa.getSchemaRefs=Db});var sp=V(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.getData=Nt.KeywordCxt=Nt.validateFunctionCode=void 0;var A3=r3(),E3=En(),Oo=wo(),A2=En(),Ob=o3(),Tn=c3(),Do=v3(),Z=me(),pe=lr(),Cb=Nn(),zr=Oe(),$n=tp();function xb(e){if(C3(e)&&(x3(e),O3(e))){Ib(e);return}D3(e,()=>(0,A3.topBoolOrEmptySchema)(e))}Nt.validateFunctionCode=xb;function D3({gen:e,validateName:a,schema:r,schemaEnv:i,opts:n},s){n.code.es5?e.func(a,(0,Z._)`${pe.default.data}, ${pe.default.valCxt}`,i.$async,()=>{e.code((0,Z._)`"use strict"; ${N3(r,n)}`),Rb(e,n),e.code(s)}):e.func(a,(0,Z._)`${pe.default.data}, ${Pb(n)}`,i.$async,()=>e.code(N3(r,n)).code(s))}function Pb(e){return(0,Z._)`{${pe.default.instancePath}="", ${pe.default.parentData}, ${pe.default.parentDataProperty}, ${pe.default.rootData}=${pe.default.data}${e.dynamicRef?(0,Z._)`, ${pe.default.dynamicAnchors}={}`:Z.nil}}={}`}function Rb(e,a){e.if(pe.default.valCxt,()=>{e.var(pe.default.instancePath,(0,Z._)`${pe.default.valCxt}.${pe.default.instancePath}`),e.var(pe.default.parentData,(0,Z._)`${pe.default.valCxt}.${pe.default.parentData}`),e.var(pe.default.parentDataProperty,(0,Z._)`${pe.default.valCxt}.${pe.default.parentDataProperty}`),e.var(pe.default.rootData,(0,Z._)`${pe.default.valCxt}.${pe.default.rootData}`),a.dynamicRef&&e.var(pe.default.dynamicAnchors,(0,Z._)`${pe.default.valCxt}.${pe.default.dynamicAnchors}`)},()=>{e.var(pe.default.instancePath,(0,Z._)`""`),e.var(pe.default.parentData,(0,Z._)`undefined`),e.var(pe.default.parentDataProperty,(0,Z._)`undefined`),e.var(pe.default.rootData,pe.default.data),a.dynamicRef&&e.var(pe.default.dynamicAnchors,(0,Z._)`{}`)})}function Ib(e){let{schema:a,opts:r,gen:i}=e;D3(e,()=>{r.$comment&&a.$comment&&R3(e),Mb(e),i.let(pe.default.vErrors,null),i.let(pe.default.errors,0),r.unevaluated&&Vb(e),P3(e),Ub(e)})}function Vb(e){let{gen:a,validateName:r}=e;e.evaluated=a.const("evaluated",(0,Z._)`${r}.evaluated`),a.if((0,Z._)`${e.evaluated}.dynamicProps`,()=>a.assign((0,Z._)`${e.evaluated}.props`,(0,Z._)`undefined`)),a.if((0,Z._)`${e.evaluated}.dynamicItems`,()=>a.assign((0,Z._)`${e.evaluated}.items`,(0,Z._)`undefined`))}function N3(e,a){let r=typeof e=="object"&&e[a.schemaId];return r&&(a.code.source||a.code.process)?(0,Z._)`/*# sourceURL=${r} */`:Z.nil}function Fb(e,a){if(C3(e)&&(x3(e),O3(e))){Lb(e,a);return}(0,A3.boolOrEmptySchema)(e,a)}function O3({schema:e,self:a}){if(typeof e=="boolean")return!e;for(let r in e)if(a.RULES.all[r])return!0;return!1}function C3(e){return typeof e.schema!="boolean"}function Lb(e,a){let{schema:r,gen:i,opts:n}=e;n.$comment&&r.$comment&&R3(e),kb(e),jb(e);let s=i.const("_errs",pe.default.errors);P3(e,s),i.var(a,(0,Z._)`${s} === ${pe.default.errors}`)}function x3(e){(0,zr.checkUnknownRules)(e),qb(e)}function P3(e,a){if(e.opts.jtd)return $3(e,[],!1,a);let r=(0,E3.getSchemaTypes)(e.schema),i=(0,E3.coerceAndCheckDataType)(e,r);$3(e,r,!i,a)}function qb(e){let{schema:a,errSchemaPath:r,opts:i,self:n}=e;a.$ref&&i.ignoreKeywordsWithRef&&(0,zr.schemaHasRulesButRef)(a,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Mb(e){let{schema:a,opts:r}=e;a.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,zr.checkStrictMode)(e,"default is ignored in the schema root")}function kb(e){let a=e.schema[e.opts.schemaId];a&&(e.baseId=(0,Cb.resolveUrl)(e.opts.uriResolver,e.baseId,a))}function jb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function R3({gen:e,schemaEnv:a,schema:r,errSchemaPath:i,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,Z._)`${pe.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let o=(0,Z.str)`${i}/$comment`,l=e.scopeValue("root",{ref:a.root});e.code((0,Z._)`${pe.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function Ub(e){let{gen:a,schemaEnv:r,validateName:i,ValidationError:n,opts:s}=e;r.$async?a.if((0,Z._)`${pe.default.errors} === 0`,()=>a.return(pe.default.data),()=>a.throw((0,Z._)`new ${n}(${pe.default.vErrors})`)):(a.assign((0,Z._)`${i}.errors`,pe.default.vErrors),s.unevaluated&&Bb(e),a.return((0,Z._)`${pe.default.errors} === 0`))}function Bb({gen:e,evaluated:a,props:r,items:i}){r instanceof Z.Name&&e.assign((0,Z._)`${a}.props`,r),i instanceof Z.Name&&e.assign((0,Z._)`${a}.items`,i)}function $3(e,a,r,i){let{gen:n,schema:s,data:o,allErrors:l,opts:m,self:c}=e,{RULES:g}=c;if(s.$ref&&(m.ignoreKeywordsWithRef||!(0,zr.schemaHasRulesButRef)(s,g))){n.block(()=>V3(e,"$ref",g.all.$ref.definition));return}m.jtd||zb(e,a),n.block(()=>{for(let b of g.rules)_(b);_(g.post)});function _(b){!(0,Oo.shouldUseGroup)(s,b)||(b.type?(n.if((0,A2.checkDataType)(b.type,o,m.strictNumbers)),T3(e,b),a.length===1&&a[0]===b.type&&r&&(n.else(),(0,A2.reportTypeError)(e)),n.endIf()):T3(e,b),l||n.if((0,Z._)`${pe.default.errors} === ${i||0}`))}}function T3(e,a){let{gen:r,schema:i,opts:{useDefaults:n}}=e;n&&(0,Ob.assignDefaults)(e,a.type),r.block(()=>{for(let s of a.rules)(0,Oo.shouldUseRule)(i,s)&&V3(e,s.keyword,s.definition,a.type)})}function zb(e,a){e.schemaEnv.meta||!e.opts.strictTypes||(Hb(e,a),e.opts.allowUnionTypes||Gb(e,a),Wb(e,e.dataTypes))}function Hb(e,a){if(!!a.length){if(!e.dataTypes.length){e.dataTypes=a;return}a.forEach(r=>{I3(e.dataTypes,r)||Co(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Yb(e,a)}}function Gb(e,a){a.length>1&&!(a.length===2&&a.includes("null"))&&Co(e,"use allowUnionTypes to allow union type keyword")}function Wb(e,a){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Oo.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(o=>Kb(a,o))&&Co(e,`missing type "${s.join(",")}" for keyword "${i}"`)}}}function Kb(e,a){return e.includes(a)||a==="number"&&e.includes("integer")}function I3(e,a){return e.includes(a)||a==="integer"&&e.includes("number")}function Yb(e,a){let r=[];for(let i of e.dataTypes)I3(a,i)?r.push(i):a.includes("integer")&&i==="number"&&r.push("integer");e.dataTypes=r}function Co(e,a){a+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,zr.checkStrictMode)(e,a,e.opts.strictTypes)}var D2=class{constructor(a,r,i){if((0,Tn.validateKeywordUsage)(a,r,i),t