UNPKG

next-csrf

Version:

CSRF mitigation library for Next.js

1 lines 149 kB
module.exports=function(f,n){"use strict";var e={};function __webpack_require__(n){if(e[n]){return e[n].exports}var s=e[n]={i:n,l:false,exports:{}};f[n].call(s.exports,s,s.exports,__webpack_require__);s.l=true;return s.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(707)}n(__webpack_require__);return startup()}({2:function(f){"use strict";f.exports=function generate_properties(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w="data"+(v||"");var j="errs__"+l;var E=f.util.copy(f);var R="";E.level++;var A="valid"+E.level;var F="key"+l,p="idx"+l,I=E.dataLevel=f.dataLevel+1,x="data"+I,z="dataProperties"+l;var U=Object.keys(r||{}),N=f.schema.patternProperties||{},Q=Object.keys(N),q=f.schema.additionalProperties,c=U.length||Q.length,C=q===false,O=typeof q=="object"&&Object.keys(q).length,L=f.opts.removeAdditional,J=C||O||L,G=f.opts.ownProperties,T=f.baseId;var H=f.schema.required;if(H&&!(f.opts.$data&&H.$data)&&H.length<f.opts.loopRequired)var X=f.util.toHash(H);s+="var "+j+" = errors;var "+A+" = true;";if(G){s+=" var "+z+" = undefined;"}if(J){if(G){s+=" "+z+" = "+z+" || Object.keys("+w+"); for (var "+p+"=0; "+p+"<"+z+".length; "+p+"++) { var "+F+" = "+z+"["+p+"]; "}else{s+=" for (var "+F+" in "+w+") { "}if(c){s+=" var isAdditional"+l+" = !(false ";if(U.length){if(U.length>8){s+=" || validate.schema"+g+".hasOwnProperty("+F+") "}else{var M=U;if(M){var Y,W=-1,B=M.length-1;while(W<B){Y=M[W+=1];s+=" || "+F+" == "+f.util.toQuotedString(Y)+" "}}}}if(Q.length){var Z=Q;if(Z){var D,K=-1,V=Z.length-1;while(K<V){D=Z[K+=1];s+=" || "+f.usePattern(D)+".test("+F+") "}}}s+=" ); if (isAdditional"+l+") { "}if(L=="all"){s+=" delete "+w+"["+F+"]; "}else{var y=f.errorPath;var k="' + "+F+" + '";if(f.opts._errorDataPathProperty){f.errorPath=f.util.getPathExpr(f.errorPath,F,f.opts.jsonPointers)}if(C){if(L){s+=" delete "+w+"["+F+"]; "}else{s+=" "+A+" = false; ";var h=b;b=f.errSchemaPath+"/additionalProperties";var a=a||[];a.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+"additionalProperties"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { additionalProperty: '"+k+"' } ";if(f.opts.messages!==false){s+=" , message: '";if(f.opts._errorDataPathProperty){s+="is an invalid additional property"}else{s+="should NOT have additional properties"}s+="' "}if(f.opts.verbose){s+=" , schema: false , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}var S=s;s=a.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+S+"]); "}else{s+=" validate.errors = ["+S+"]; return false; "}}else{s+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}b=h;if(d){s+=" break; "}}}else if(O){if(L=="failing"){s+=" var "+j+" = errors; ";var m=f.compositeRule;f.compositeRule=E.compositeRule=true;E.schema=q;E.schemaPath=f.schemaPath+".additionalProperties";E.errSchemaPath=f.errSchemaPath+"/additionalProperties";E.errorPath=f.opts._errorDataPathProperty?f.errorPath:f.util.getPathExpr(f.errorPath,F,f.opts.jsonPointers);var P=w+"["+F+"]";E.dataPathArr[I]=F;var i=f.validate(E);E.baseId=T;if(f.util.varOccurences(i,x)<2){s+=" "+f.util.varReplace(i,x,P)+" "}else{s+=" var "+x+" = "+P+"; "+i+" "}s+=" if (!"+A+") { errors = "+j+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+w+"["+F+"]; } ";f.compositeRule=E.compositeRule=m}else{E.schema=q;E.schemaPath=f.schemaPath+".additionalProperties";E.errSchemaPath=f.errSchemaPath+"/additionalProperties";E.errorPath=f.opts._errorDataPathProperty?f.errorPath:f.util.getPathExpr(f.errorPath,F,f.opts.jsonPointers);var P=w+"["+F+"]";E.dataPathArr[I]=F;var i=f.validate(E);E.baseId=T;if(f.util.varOccurences(i,x)<2){s+=" "+f.util.varReplace(i,x,P)+" "}else{s+=" var "+x+" = "+P+"; "+i+" "}if(d){s+=" if (!"+A+") break; "}}}f.errorPath=y}if(c){s+=" } "}s+=" } ";if(d){s+=" if ("+A+") { ";R+="}"}}var _=f.opts.useDefaults&&!f.compositeRule;if(U.length){var u=U;if(u){var Y,o=-1,$=u.length-1;while(o<$){Y=u[o+=1];var t=r[Y];if(f.opts.strictKeywords?typeof t=="object"&&Object.keys(t).length>0:f.util.schemaHasRules(t,f.RULES.all)){var ff=f.util.getProperty(Y),P=w+ff,nf=_&&t.default!==undefined;E.schema=t;E.schemaPath=g+ff;E.errSchemaPath=b+"/"+f.util.escapeFragment(Y);E.errorPath=f.util.getPath(f.errorPath,Y,f.opts.jsonPointers);E.dataPathArr[I]=f.util.toQuotedString(Y);var i=f.validate(E);E.baseId=T;if(f.util.varOccurences(i,x)<2){i=f.util.varReplace(i,x,P);var ef=P}else{var ef=x;s+=" var "+x+" = "+P+"; "}if(nf){s+=" "+i+" "}else{if(X&&X[Y]){s+=" if ( "+ef+" === undefined ";if(G){s+=" || ! Object.prototype.hasOwnProperty.call("+w+", '"+f.util.escapeQuotes(Y)+"') "}s+=") { "+A+" = false; ";var y=f.errorPath,h=b,sf=f.util.escapeQuotes(Y);if(f.opts._errorDataPathProperty){f.errorPath=f.util.getPath(y,Y,f.opts.jsonPointers)}b=f.errSchemaPath+"/required";var a=a||[];a.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+"required"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { missingProperty: '"+sf+"' } ";if(f.opts.messages!==false){s+=" , message: '";if(f.opts._errorDataPathProperty){s+="is a required property"}else{s+="should have required property \\'"+sf+"\\'"}s+="' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}var S=s;s=a.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+S+"]); "}else{s+=" validate.errors = ["+S+"]; return false; "}}else{s+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}b=h;f.errorPath=y;s+=" } else { "}else{if(d){s+=" if ( "+ef+" === undefined ";if(G){s+=" || ! Object.prototype.hasOwnProperty.call("+w+", '"+f.util.escapeQuotes(Y)+"') "}s+=") { "+A+" = true; } else { "}else{s+=" if ("+ef+" !== undefined ";if(G){s+=" && Object.prototype.hasOwnProperty.call("+w+", '"+f.util.escapeQuotes(Y)+"') "}s+=" ) { "}}s+=" "+i+" } "}}if(d){s+=" if ("+A+") { ";R+="}"}}}}if(Q.length){var lf=Q;if(lf){var D,vf=-1,rf=lf.length-1;while(vf<rf){D=lf[vf+=1];var t=N[D];if(f.opts.strictKeywords?typeof t=="object"&&Object.keys(t).length>0:f.util.schemaHasRules(t,f.RULES.all)){E.schema=t;E.schemaPath=f.schemaPath+".patternProperties"+f.util.getProperty(D);E.errSchemaPath=f.errSchemaPath+"/patternProperties/"+f.util.escapeFragment(D);if(G){s+=" "+z+" = "+z+" || Object.keys("+w+"); for (var "+p+"=0; "+p+"<"+z+".length; "+p+"++) { var "+F+" = "+z+"["+p+"]; "}else{s+=" for (var "+F+" in "+w+") { "}s+=" if ("+f.usePattern(D)+".test("+F+")) { ";E.errorPath=f.util.getPathExpr(f.errorPath,F,f.opts.jsonPointers);var P=w+"["+F+"]";E.dataPathArr[I]=F;var i=f.validate(E);E.baseId=T;if(f.util.varOccurences(i,x)<2){s+=" "+f.util.varReplace(i,x,P)+" "}else{s+=" var "+x+" = "+P+"; "+i+" "}if(d){s+=" if (!"+A+") break; "}s+=" } ";if(d){s+=" else "+A+" = true; "}s+=" } ";if(d){s+=" if ("+A+") { ";R+="}"}}}}}if(d){s+=" "+R+" if ("+j+" == errors) {"}s=f.util.cleanUpCode(s);return s}},13:function(f){f.exports=require("worker_threads")},43:function(f,n,e){"use strict";const s=e(678);const l=["__proto__","prototype","constructor"];const v=f=>!f.some(f=>l.includes(f));function getPathSegments(f){const n=f.split(".");const e=[];for(let f=0;f<n.length;f++){let s=n[f];while(s[s.length-1]==="\\"&&n[f+1]!==undefined){s=s.slice(0,-1)+".";s+=n[++f]}e.push(s)}if(!v(e)){return[]}return e}f.exports={get(f,n,e){if(!s(f)||typeof n!=="string"){return e===undefined?f:e}const l=getPathSegments(n);if(l.length===0){return}for(let n=0;n<l.length;n++){if(!Object.prototype.propertyIsEnumerable.call(f,l[n])){return e}f=f[l[n]];if(f===undefined||f===null){if(n!==l.length-1){return e}break}}return f},set(f,n,e){if(!s(f)||typeof n!=="string"){return f}const l=f;const v=getPathSegments(n);for(let n=0;n<v.length;n++){const l=v[n];if(!s(f[l])){f[l]={}}if(n===v.length-1){f[l]=e}f=f[l]}return l},delete(f,n){if(!s(f)||typeof n!=="string"){return}const e=getPathSegments(n);for(let n=0;n<e.length;n++){const l=e[n];if(n===e.length-1){delete f[l];return}f=f[l];if(!s(f)){return}}},has(f,n){if(!s(f)||typeof n!=="string"){return false}const e=getPathSegments(n);if(e.length===0){return false}for(let n=0;n<e.length;n++){if(s(f)){if(!(e[n]in f)){return false}f=f[e[n]]}else{return false}}return true}}},44:function(f){"use strict";f.exports=function generate_format(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w="data"+(v||"");if(f.opts.format===false){if(d){s+=" if (true) { "}return s}var j=f.opts.$data&&r&&r.$data,E;if(j){s+=" var schema"+l+" = "+f.util.getData(r.$data,v,f.dataPathArr)+"; ";E="schema"+l}else{E=r}var R=f.opts.unknownFormats,A=Array.isArray(R);if(j){var F="format"+l,p="isObject"+l,I="formatType"+l;s+=" var "+F+" = formats["+E+"]; var "+p+" = typeof "+F+" == 'object' && !("+F+" instanceof RegExp) && "+F+".validate; var "+I+" = "+p+" && "+F+".type || 'string'; if ("+p+") { ";if(f.async){s+=" var async"+l+" = "+F+".async; "}s+=" "+F+" = "+F+".validate; } if ( ";if(j){s+=" ("+E+" !== undefined && typeof "+E+" != 'string') || "}s+=" (";if(R!="ignore"){s+=" ("+E+" && !"+F+" ";if(A){s+=" && self._opts.unknownFormats.indexOf("+E+") == -1 "}s+=") || "}s+=" ("+F+" && "+I+" == '"+e+"' && !(typeof "+F+" == 'function' ? ";if(f.async){s+=" (async"+l+" ? await "+F+"("+w+") : "+F+"("+w+")) "}else{s+=" "+F+"("+w+") "}s+=" : "+F+".test("+w+"))))) {"}else{var F=f.formats[r];if(!F){if(R=="ignore"){f.logger.warn('unknown format "'+r+'" ignored in schema at path "'+f.errSchemaPath+'"');if(d){s+=" if (true) { "}return s}else if(A&&R.indexOf(r)>=0){if(d){s+=" if (true) { "}return s}else{throw new Error('unknown format "'+r+'" is used in schema at path "'+f.errSchemaPath+'"')}}var p=typeof F=="object"&&!(F instanceof RegExp)&&F.validate;var I=p&&F.type||"string";if(p){var x=F.async===true;F=F.validate}if(I!=e){if(d){s+=" if (true) { "}return s}if(x){if(!f.async)throw new Error("async format in sync schema");var z="formats"+f.util.getProperty(r)+".validate";s+=" if (!(await "+z+"("+w+"))) { "}else{s+=" if (! ";var z="formats"+f.util.getProperty(r);if(p)z+=".validate";if(typeof F=="function"){s+=" "+z+"("+w+") "}else{s+=" "+z+".test("+w+") "}s+=") { "}}var U=U||[];U.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+"format"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { format: ";if(j){s+=""+E}else{s+=""+f.util.toQuotedString(r)}s+=" } ";if(f.opts.messages!==false){s+=" , message: 'should match format \"";if(j){s+="' + "+E+" + '"}else{s+=""+f.util.escapeQuotes(r)}s+="\"' "}if(f.opts.verbose){s+=" , schema: ";if(j){s+="validate.schema"+g}else{s+=""+f.util.toQuotedString(r)}s+=" , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}var N=s;s=U.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+N+"]); "}else{s+=" validate.errors = ["+N+"]; return false; "}}else{s+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } ";if(d){s+=" else { "}return s}},87:function(f){f.exports=require("os")},104:function(f){"use strict";f.exports=function generate__limit(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w;var j="data"+(v||"");var E=f.opts.$data&&r&&r.$data,R;if(E){s+=" var schema"+l+" = "+f.util.getData(r.$data,v,f.dataPathArr)+"; ";R="schema"+l}else{R=r}var A=n=="maximum",F=A?"exclusiveMaximum":"exclusiveMinimum",p=f.schema[F],I=f.opts.$data&&p&&p.$data,x=A?"<":">",z=A?">":"<",w=undefined;if(I){var U=f.util.getData(p.$data,v,f.dataPathArr),N="exclusive"+l,Q="exclType"+l,q="exclIsNumber"+l,c="op"+l,C="' + "+c+" + '";s+=" var schemaExcl"+l+" = "+U+"; ";U="schemaExcl"+l;s+=" var "+N+"; var "+Q+" = typeof "+U+"; if ("+Q+" != 'boolean' && "+Q+" != 'undefined' && "+Q+" != 'number') { ";var w=F;var O=O||[];O.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(w||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: {} ";if(f.opts.messages!==false){s+=" , message: '"+F+" should be boolean' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+j+" "}s+=" } "}else{s+=" {} "}var L=s;s=O.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+L+"]); "}else{s+=" validate.errors = ["+L+"]; return false; "}}else{s+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } else if ( ";if(E){s+=" ("+R+" !== undefined && typeof "+R+" != 'number') || "}s+=" "+Q+" == 'number' ? ( ("+N+" = "+R+" === undefined || "+U+" "+x+"= "+R+") ? "+j+" "+z+"= "+U+" : "+j+" "+z+" "+R+" ) : ( ("+N+" = "+U+" === true) ? "+j+" "+z+"= "+R+" : "+j+" "+z+" "+R+" ) || "+j+" !== "+j+") { var op"+l+" = "+N+" ? '"+x+"' : '"+x+"='; ";if(r===undefined){w=F;b=f.errSchemaPath+"/"+F;R=U;E=I}}else{var q=typeof p=="number",C=x;if(q&&E){var c="'"+C+"'";s+=" if ( ";if(E){s+=" ("+R+" !== undefined && typeof "+R+" != 'number') || "}s+=" ( "+R+" === undefined || "+p+" "+x+"= "+R+" ? "+j+" "+z+"= "+p+" : "+j+" "+z+" "+R+" ) || "+j+" !== "+j+") { "}else{if(q&&r===undefined){N=true;w=F;b=f.errSchemaPath+"/"+F;R=p;z+="="}else{if(q)R=Math[A?"min":"max"](p,r);if(p===(q?R:true)){N=true;w=F;b=f.errSchemaPath+"/"+F;z+="="}else{N=false;C+="="}}var c="'"+C+"'";s+=" if ( ";if(E){s+=" ("+R+" !== undefined && typeof "+R+" != 'number') || "}s+=" "+j+" "+z+" "+R+" || "+j+" !== "+j+") { "}}w=w||n;var O=O||[];O.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(w||"_limit")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { comparison: "+c+", limit: "+R+", exclusive: "+N+" } ";if(f.opts.messages!==false){s+=" , message: 'should be "+C+" ";if(E){s+="' + "+R}else{s+=""+R+"'"}}if(f.opts.verbose){s+=" , schema: ";if(E){s+="validate.schema"+g}else{s+=""+r}s+=" , parentSchema: validate.schema"+f.schemaPath+" , data: "+j+" "}s+=" } "}else{s+=" {} "}var L=s;s=O.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+L+"]); "}else{s+=" validate.errors = ["+L+"]; return false; "}}else{s+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } ";if(d){s+=" else { "}return s}},106:function(f){"use strict";f.exports=function generate_propertyNames(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w="data"+(v||"");var j="errs__"+l;var E=f.util.copy(f);var R="";E.level++;var A="valid"+E.level;s+="var "+j+" = errors;";if(f.opts.strictKeywords?typeof r=="object"&&Object.keys(r).length>0:f.util.schemaHasRules(r,f.RULES.all)){E.schema=r;E.schemaPath=g;E.errSchemaPath=b;var F="key"+l,p="idx"+l,I="i"+l,x="' + "+F+" + '",z=E.dataLevel=f.dataLevel+1,U="data"+z,N="dataProperties"+l,Q=f.opts.ownProperties,q=f.baseId;if(Q){s+=" var "+N+" = undefined; "}if(Q){s+=" "+N+" = "+N+" || Object.keys("+w+"); for (var "+p+"=0; "+p+"<"+N+".length; "+p+"++) { var "+F+" = "+N+"["+p+"]; "}else{s+=" for (var "+F+" in "+w+") { "}s+=" var startErrs"+l+" = errors; ";var c=F;var C=f.compositeRule;f.compositeRule=E.compositeRule=true;var O=f.validate(E);E.baseId=q;if(f.util.varOccurences(O,U)<2){s+=" "+f.util.varReplace(O,U,c)+" "}else{s+=" var "+U+" = "+c+"; "+O+" "}f.compositeRule=E.compositeRule=C;s+=" if (!"+A+") { for (var "+I+"=startErrs"+l+"; "+I+"<errors; "+I+"++) { vErrors["+I+"].propertyName = "+F+"; } var err = ";if(f.createErrors!==false){s+=" { keyword: '"+"propertyNames"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { propertyName: '"+x+"' } ";if(f.opts.messages!==false){s+=" , message: 'property name \\'"+x+"\\' is invalid' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(vErrors); "}else{s+=" validate.errors = vErrors; return false; "}}if(d){s+=" break; "}s+=" } }"}if(d){s+=" "+R+" if ("+j+" == errors) {"}s=f.util.cleanUpCode(s);return s}},109:function(f,n,e){"use strict";const s=e(622);const l=e(87);const v=l.homedir();const r=l.tmpdir();const{env:g}=process;const b=f=>{const n=s.join(v,"Library");return{data:s.join(n,"Application Support",f),config:s.join(n,"Preferences",f),cache:s.join(n,"Caches",f),log:s.join(n,"Logs",f),temp:s.join(r,f)}};const d=f=>{const n=g.APPDATA||s.join(v,"AppData","Roaming");const e=g.LOCALAPPDATA||s.join(v,"AppData","Local");return{data:s.join(e,f,"Data"),config:s.join(n,f,"Config"),cache:s.join(e,f,"Cache"),log:s.join(e,f,"Log"),temp:s.join(r,f)}};const w=f=>{const n=s.basename(v);return{data:s.join(g.XDG_DATA_HOME||s.join(v,".local","share"),f),config:s.join(g.XDG_CONFIG_HOME||s.join(v,".config"),f),cache:s.join(g.XDG_CACHE_HOME||s.join(v,".cache"),f),log:s.join(g.XDG_STATE_HOME||s.join(v,".local","state"),f),temp:s.join(r,n,f)}};const j=(f,n)=>{if(typeof f!=="string"){throw new TypeError(`Expected string, got ${typeof f}`)}n=Object.assign({suffix:"nodejs"},n);if(n.suffix){f+=`-${n.suffix}`}if(process.platform==="darwin"){return b(f)}if(process.platform==="win32"){return d(f)}return w(f)};f.exports=j;f.exports.default=j},121:function(f){"use strict";f.exports=function generate__limitLength(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w;var j="data"+(v||"");var E=f.opts.$data&&r&&r.$data,R;if(E){s+=" var schema"+l+" = "+f.util.getData(r.$data,v,f.dataPathArr)+"; ";R="schema"+l}else{R=r}var A=n=="maxLength"?">":"<";s+="if ( ";if(E){s+=" ("+R+" !== undefined && typeof "+R+" != 'number') || "}if(f.opts.unicode===false){s+=" "+j+".length "}else{s+=" ucs2length("+j+") "}s+=" "+A+" "+R+") { ";var w=n;var F=F||[];F.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(w||"_limitLength")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { limit: "+R+" } ";if(f.opts.messages!==false){s+=" , message: 'should NOT be ";if(n=="maxLength"){s+="longer"}else{s+="shorter"}s+=" than ";if(E){s+="' + "+R+" + '"}else{s+=""+r}s+=" characters' "}if(f.opts.verbose){s+=" , schema: ";if(E){s+="validate.schema"+g}else{s+=""+r}s+=" , parentSchema: validate.schema"+f.schemaPath+" , data: "+j+" "}s+=" } "}else{s+=" {} "}var p=s;s=F.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+p+"]); "}else{s+=" validate.errors = ["+p+"]; return false; "}}else{s+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+="} ";if(d){s+=" else { "}return s}},145:function(f,n,e){var s=e(357);var l=e(573);var v=e(614);if(typeof v!=="function"){v=v.EventEmitter}var r;if(process.__signal_exit_emitter__){r=process.__signal_exit_emitter__}else{r=process.__signal_exit_emitter__=new v;r.count=0;r.emitted={}}if(!r.infinite){r.setMaxListeners(Infinity);r.infinite=true}f.exports=function(f,n){s.equal(typeof f,"function","a callback must be provided for exit handler");if(b===false){load()}var e="exit";if(n&&n.alwaysLast){e="afterexit"}var l=function(){r.removeListener(e,f);if(r.listeners("exit").length===0&&r.listeners("afterexit").length===0){unload()}};r.on(e,f);return l};f.exports.unload=unload;function unload(){if(!b){return}b=false;l.forEach(function(f){try{process.removeListener(f,g[f])}catch(f){}});process.emit=w;process.reallyExit=d;r.count-=1}function emit(f,n,e){if(r.emitted[f]){return}r.emitted[f]=true;r.emit(f,n,e)}var g={};l.forEach(function(f){g[f]=function listener(){var n=process.listeners(f);if(n.length===r.count){unload();emit("exit",null,f);emit("afterexit",null,f);process.kill(process.pid,f)}}});f.exports.signals=function(){return l};f.exports.load=load;var b=false;function load(){if(b){return}b=true;r.count+=1;l=l.filter(function(f){try{process.on(f,g[f]);return true}catch(f){return false}});process.emit=processEmit;process.reallyExit=processReallyExit}var d=process.reallyExit;function processReallyExit(f){process.exitCode=f||0;emit("exit",process.exitCode,null);emit("afterexit",process.exitCode,null);d.call(process,process.exitCode)}var w=process.emit;function processEmit(f,n){if(f==="exit"){if(n!==undefined){process.exitCode=n}var e=w.apply(this,arguments);emit("exit",process.exitCode,null);emit("afterexit",process.exitCode,null);return e}else{return w.apply(this,arguments)}}},151:function(f){"use strict";f.exports=function equal(f,n){if(f===n)return true;if(f&&n&&typeof f=="object"&&typeof n=="object"){if(f.constructor!==n.constructor)return false;var e,s,l;if(Array.isArray(f)){e=f.length;if(e!=n.length)return false;for(s=e;s--!==0;)if(!equal(f[s],n[s]))return false;return true}if(f.constructor===RegExp)return f.source===n.source&&f.flags===n.flags;if(f.valueOf!==Object.prototype.valueOf)return f.valueOf()===n.valueOf();if(f.toString!==Object.prototype.toString)return f.toString()===n.toString();l=Object.keys(f);e=l.length;if(e!==Object.keys(n).length)return false;for(s=e;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,l[s]))return false;for(s=e;s--!==0;){var v=l[s];if(!equal(f[v],n[v]))return false}return true}return f!==f&&n!==n}},198:function(f,n,e){"use strict";f.exports={$ref:e(700),allOf:e(677),anyOf:e(398),$comment:e(809),const:e(644),contains:e(334),dependencies:e(863),enum:e(621),format:e(44),if:e(484),items:e(330),maximum:e(104),minimum:e(104),maxItems:e(674),minItems:e(674),maxLength:e(121),minLength:e(121),maxProperties:e(464),minProperties:e(464),multipleOf:e(782),not:e(929),oneOf:e(455),pattern:e(583),properties:e(2),propertyNames:e(106),required:e(916),uniqueItems:e(586),validate:e(273)}},229:function(f,n,e){"use strict";f.exports=writeFile;f.exports.sync=writeFileSync;f.exports._getTmpname=getTmpname;f.exports._cleanupOnExit=cleanupOnExit;const s=e(747);const l=e(970);const v=e(145);const r=e(622);const g=e(590);const b=e(840);const{promisify:d}=e(669);const w={};const j=function getId(){try{const f=e(13);return f.threadId}catch(f){return 0}}();let E=0;function getTmpname(f){return f+"."+l(__filename).hash(String(process.pid)).hash(String(j)).hash(String(++E)).result()}function cleanupOnExit(f){return()=>{try{s.unlinkSync(typeof f==="function"?f():f)}catch(f){}}}function serializeActiveFile(f){return new Promise(n=>{if(!w[f])w[f]=[];w[f].push(n);if(w[f].length===1)n()})}async function writeFileAsync(f,n,e={}){if(typeof e==="string"){e={encoding:e}}let l;let j;const E=v(cleanupOnExit(()=>j));const R=r.resolve(f);try{await serializeActiveFile(R);const v=await d(s.realpath)(f).catch(()=>f);j=getTmpname(v);if(!e.mode||!e.chown){const f=await d(s.stat)(v).catch(()=>{});if(f){if(e.mode==null){e.mode=f.mode}if(e.chown==null&&process.getuid){e.chown={uid:f.uid,gid:f.gid}}}}l=await d(s.open)(j,"w",e.mode);if(e.tmpfileCreated){await e.tmpfileCreated(j)}if(g(n)){n=b(n)}if(Buffer.isBuffer(n)){await d(s.write)(l,n,0,n.length,0)}else if(n!=null){await d(s.write)(l,String(n),0,String(e.encoding||"utf8"))}if(e.fsync!==false){await d(s.fsync)(l)}await d(s.close)(l);l=null;if(e.chown){await d(s.chown)(j,e.chown.uid,e.chown.gid)}if(e.mode){await d(s.chmod)(j,e.mode)}await d(s.rename)(j,v)}finally{if(l){await d(s.close)(l).catch(()=>{})}E();await d(s.unlink)(j).catch(()=>{});w[R].shift();if(w[R].length>0){w[R][0]()}else delete w[R]}}function writeFile(f,n,e,s){if(e instanceof Function){s=e;e={}}const l=writeFileAsync(f,n,e);if(s){l.then(s,s)}return l}function writeFileSync(f,n,e){if(typeof e==="string")e={encoding:e};else if(!e)e={};try{f=s.realpathSync(f)}catch(f){}const l=getTmpname(f);if(!e.mode||!e.chown){try{const n=s.statSync(f);e=Object.assign({},e);if(!e.mode){e.mode=n.mode}if(!e.chown&&process.getuid){e.chown={uid:n.uid,gid:n.gid}}}catch(f){}}let r;const d=cleanupOnExit(l);const w=v(d);let j=true;try{r=s.openSync(l,"w",e.mode);if(e.tmpfileCreated){e.tmpfileCreated(l)}if(g(n)){n=b(n)}if(Buffer.isBuffer(n)){s.writeSync(r,n,0,n.length,0)}else if(n!=null){s.writeSync(r,String(n),0,String(e.encoding||"utf8"))}if(e.fsync!==false){s.fsyncSync(r)}s.closeSync(r);r=null;if(e.chown)s.chownSync(l,e.chown.uid,e.chown.gid);if(e.mode)s.chmodSync(l,e.mode);s.renameSync(l,f);j=false}finally{if(r){try{s.closeSync(r)}catch(f){}}w();if(j){d()}}}},272:function(f,n,e){"use strict";var s=e(889).MissingRef;f.exports=compileAsync;function compileAsync(f,n,e){var l=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof n=="function"){e=n;n=undefined}var v=loadMetaSchemaOf(f).then(function(){var e=l._addSchema(f,undefined,n);return e.validate||_compileAsync(e)});if(e){v.then(function(f){e(null,f)},e)}return v;function loadMetaSchemaOf(f){var n=f.$schema;return n&&!l.getSchema(n)?compileAsync.call(l,{$ref:n},true):Promise.resolve()}function _compileAsync(f){try{return l._compile(f)}catch(f){if(f instanceof s)return loadMissingSchema(f);throw f}function loadMissingSchema(e){var s=e.missingSchema;if(added(s))throw new Error("Schema "+s+" is loaded but "+e.missingRef+" cannot be resolved");var v=l._loadingSchemas[s];if(!v){v=l._loadingSchemas[s]=l._opts.loadSchema(s);v.then(removePromise,removePromise)}return v.then(function(f){if(!added(s)){return loadMetaSchemaOf(f).then(function(){if(!added(s))l.addSchema(f,s,undefined,n)})}}).then(function(){return _compileAsync(f)});function removePromise(){delete l._loadingSchemas[s]}function added(f){return l._refs[f]||l._schemas[f]}}}}},273:function(f){"use strict";f.exports=function generate_validate(f,n,e){var s="";var l=f.schema.$async===true,v=f.util.schemaHasRulesExcept(f.schema,f.RULES.all,"$ref"),r=f.self._getId(f.schema);if(f.opts.strictKeywords){var g=f.util.schemaUnknownRules(f.schema,f.RULES.keywords);if(g){var b="unknown keyword: "+g;if(f.opts.strictKeywords==="log")f.logger.warn(b);else throw new Error(b)}}if(f.isTop){s+=" var validate = ";if(l){f.async=true;s+="async "}s+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ";if(r&&(f.opts.sourceCode||f.opts.processCode)){s+=" "+("/*# sourceURL="+r+" */")+" "}}if(typeof f.schema=="boolean"||!(v||f.schema.$ref)){var n="false schema";var d=f.level;var w=f.dataLevel;var j=f.schema[n];var E=f.schemaPath+f.util.getProperty(n);var R=f.errSchemaPath+"/"+n;var A=!f.opts.allErrors;var F;var p="data"+(w||"");var I="valid"+d;if(f.schema===false){if(f.isTop){A=true}else{s+=" var "+I+" = false; "}var x=x||[];x.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(F||"false schema")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(R)+" , params: {} ";if(f.opts.messages!==false){s+=" , message: 'boolean schema is false' "}if(f.opts.verbose){s+=" , schema: false , parentSchema: validate.schema"+f.schemaPath+" , data: "+p+" "}s+=" } "}else{s+=" {} "}var z=s;s=x.pop();if(!f.compositeRule&&A){if(f.async){s+=" throw new ValidationError(["+z+"]); "}else{s+=" validate.errors = ["+z+"]; return false; "}}else{s+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}}else{if(f.isTop){if(l){s+=" return data; "}else{s+=" validate.errors = null; return true; "}}else{s+=" var "+I+" = true; "}}if(f.isTop){s+=" }; return validate; "}return s}if(f.isTop){var U=f.isTop,d=f.level=0,w=f.dataLevel=0,p="data";f.rootId=f.resolve.fullPath(f.self._getId(f.root.schema));f.baseId=f.baseId||f.rootId;delete f.isTop;f.dataPathArr=[undefined];if(f.schema.default!==undefined&&f.opts.useDefaults&&f.opts.strictDefaults){var N="default is ignored in the schema root";if(f.opts.strictDefaults==="log")f.logger.warn(N);else throw new Error(N)}s+=" var vErrors = null; ";s+=" var errors = 0; ";s+=" if (rootData === undefined) rootData = data; "}else{var d=f.level,w=f.dataLevel,p="data"+(w||"");if(r)f.baseId=f.resolve.url(f.baseId,r);if(l&&!f.async)throw new Error("async schema in sync schema");s+=" var errs_"+d+" = errors;"}var I="valid"+d,A=!f.opts.allErrors,Q="",q="";var F;var c=f.schema.type,C=Array.isArray(c);if(c&&f.opts.nullable&&f.schema.nullable===true){if(C){if(c.indexOf("null")==-1)c=c.concat("null")}else if(c!="null"){c=[c,"null"];C=true}}if(C&&c.length==1){c=c[0];C=false}if(f.schema.$ref&&v){if(f.opts.extendRefs=="fail"){throw new Error('$ref: validation keywords used in schema at path "'+f.errSchemaPath+'" (see option extendRefs)')}else if(f.opts.extendRefs!==true){v=false;f.logger.warn('$ref: keywords ignored in schema at path "'+f.errSchemaPath+'"')}}if(f.schema.$comment&&f.opts.$comment){s+=" "+f.RULES.all.$comment.code(f,"$comment")}if(c){if(f.opts.coerceTypes){var O=f.util.coerceToTypes(f.opts.coerceTypes,c)}var L=f.RULES.types[c];if(O||C||L===true||L&&!$shouldUseGroup(L)){var E=f.schemaPath+".type",R=f.errSchemaPath+"/type";var E=f.schemaPath+".type",R=f.errSchemaPath+"/type",J=C?"checkDataTypes":"checkDataType";s+=" if ("+f.util[J](c,p,true)+") { ";if(O){var G="dataType"+d,T="coerced"+d;s+=" var "+G+" = typeof "+p+"; ";if(f.opts.coerceTypes=="array"){s+=" if ("+G+" == 'object' && Array.isArray("+p+")) "+G+" = 'array'; "}s+=" var "+T+" = undefined; ";var H="";var X=O;if(X){var M,Y=-1,W=X.length-1;while(Y<W){M=X[Y+=1];if(Y){s+=" if ("+T+" === undefined) { ";H+="}"}if(f.opts.coerceTypes=="array"&&M!="array"){s+=" if ("+G+" == 'array' && "+p+".length == 1) { "+T+" = "+p+" = "+p+"[0]; "+G+" = typeof "+p+"; } "}if(M=="string"){s+=" if ("+G+" == 'number' || "+G+" == 'boolean') "+T+" = '' + "+p+"; else if ("+p+" === null) "+T+" = ''; "}else if(M=="number"||M=="integer"){s+=" if ("+G+" == 'boolean' || "+p+" === null || ("+G+" == 'string' && "+p+" && "+p+" == +"+p+" ";if(M=="integer"){s+=" && !("+p+" % 1)"}s+=")) "+T+" = +"+p+"; "}else if(M=="boolean"){s+=" if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+T+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+T+" = true; "}else if(M=="null"){s+=" if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+T+" = null; "}else if(f.opts.coerceTypes=="array"&&M=="array"){s+=" if ("+G+" == 'string' || "+G+" == 'number' || "+G+" == 'boolean' || "+p+" == null) "+T+" = ["+p+"]; "}}}s+=" "+H+" if ("+T+" === undefined) { ";var x=x||[];x.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(R)+" , params: { type: '";if(C){s+=""+c.join(",")}else{s+=""+c}s+="' } ";if(f.opts.messages!==false){s+=" , message: 'should be ";if(C){s+=""+c.join(",")}else{s+=""+c}s+="' "}if(f.opts.verbose){s+=" , schema: validate.schema"+E+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+p+" "}s+=" } "}else{s+=" {} "}var z=s;s=x.pop();if(!f.compositeRule&&A){if(f.async){s+=" throw new ValidationError(["+z+"]); "}else{s+=" validate.errors = ["+z+"]; return false; "}}else{s+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } else { ";var B=w?"data"+(w-1||""):"parentData",Z=w?f.dataPathArr[w]:"parentDataProperty";s+=" "+p+" = "+T+"; ";if(!w){s+="if ("+B+" !== undefined)"}s+=" "+B+"["+Z+"] = "+T+"; } "}else{var x=x||[];x.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(R)+" , params: { type: '";if(C){s+=""+c.join(",")}else{s+=""+c}s+="' } ";if(f.opts.messages!==false){s+=" , message: 'should be ";if(C){s+=""+c.join(",")}else{s+=""+c}s+="' "}if(f.opts.verbose){s+=" , schema: validate.schema"+E+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+p+" "}s+=" } "}else{s+=" {} "}var z=s;s=x.pop();if(!f.compositeRule&&A){if(f.async){s+=" throw new ValidationError(["+z+"]); "}else{s+=" validate.errors = ["+z+"]; return false; "}}else{s+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}}s+=" } "}}if(f.schema.$ref&&!v){s+=" "+f.RULES.all.$ref.code(f,"$ref")+" ";if(A){s+=" } if (errors === ";if(U){s+="0"}else{s+="errs_"+d}s+=") { ";q+="}"}}else{var D=f.RULES;if(D){var L,K=-1,V=D.length-1;while(K<V){L=D[K+=1];if($shouldUseGroup(L)){if(L.type){s+=" if ("+f.util.checkDataType(L.type,p)+") { "}if(f.opts.useDefaults){if(L.type=="object"&&f.schema.properties){var j=f.schema.properties,y=Object.keys(j);var k=y;if(k){var h,a=-1,S=k.length-1;while(a<S){h=k[a+=1];var m=j[h];if(m.default!==undefined){var P=p+f.util.getProperty(h);if(f.compositeRule){if(f.opts.strictDefaults){var N="default is ignored for: "+P;if(f.opts.strictDefaults==="log")f.logger.warn(N);else throw new Error(N)}}else{s+=" if ("+P+" === undefined ";if(f.opts.useDefaults=="empty"){s+=" || "+P+" === null || "+P+" === '' "}s+=" ) "+P+" = ";if(f.opts.useDefaults=="shared"){s+=" "+f.useDefault(m.default)+" "}else{s+=" "+JSON.stringify(m.default)+" "}s+="; "}}}}}else if(L.type=="array"&&Array.isArray(f.schema.items)){var i=f.schema.items;if(i){var m,Y=-1,_=i.length-1;while(Y<_){m=i[Y+=1];if(m.default!==undefined){var P=p+"["+Y+"]";if(f.compositeRule){if(f.opts.strictDefaults){var N="default is ignored for: "+P;if(f.opts.strictDefaults==="log")f.logger.warn(N);else throw new Error(N)}}else{s+=" if ("+P+" === undefined ";if(f.opts.useDefaults=="empty"){s+=" || "+P+" === null || "+P+" === '' "}s+=" ) "+P+" = ";if(f.opts.useDefaults=="shared"){s+=" "+f.useDefault(m.default)+" "}else{s+=" "+JSON.stringify(m.default)+" "}s+="; "}}}}}}var u=L.rules;if(u){var o,$=-1,t=u.length-1;while($<t){o=u[$+=1];if($shouldUseRule(o)){var ff=o.code(f,o.keyword,L.type);if(ff){s+=" "+ff+" ";if(A){Q+="}"}}}}}if(A){s+=" "+Q+" ";Q=""}if(L.type){s+=" } ";if(c&&c===L.type&&!O){s+=" else { ";var E=f.schemaPath+".type",R=f.errSchemaPath+"/type";var x=x||[];x.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(R)+" , params: { type: '";if(C){s+=""+c.join(",")}else{s+=""+c}s+="' } ";if(f.opts.messages!==false){s+=" , message: 'should be ";if(C){s+=""+c.join(",")}else{s+=""+c}s+="' "}if(f.opts.verbose){s+=" , schema: validate.schema"+E+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+p+" "}s+=" } "}else{s+=" {} "}var z=s;s=x.pop();if(!f.compositeRule&&A){if(f.async){s+=" throw new ValidationError(["+z+"]); "}else{s+=" validate.errors = ["+z+"]; return false; "}}else{s+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } "}}if(A){s+=" if (errors === ";if(U){s+="0"}else{s+="errs_"+d}s+=") { ";q+="}"}}}}}if(A){s+=" "+q+" "}if(U){if(l){s+=" if (errors === 0) return data; ";s+=" else throw new ValidationError(vErrors); "}else{s+=" validate.errors = vErrors; ";s+=" return errors === 0; "}s+=" }; return validate;"}else{s+=" var "+I+" = errors === errs_"+d+";"}s=f.util.cleanUpCode(s);if(U){s=f.util.finalCleanUpCode(s,l)}function $shouldUseGroup(f){var n=f.rules;for(var e=0;e<n.length;e++)if($shouldUseRule(n[e]))return true}function $shouldUseRule(n){return f.schema[n.keyword]!==undefined||n.implements&&$ruleImplementsSomeKeyword(n)}function $ruleImplementsSomeKeyword(n){var e=n.implements;for(var s=0;s<e.length;s++)if(f.schema[e[s]]!==undefined)return true}return s}},289:function(f,n,e){"use strict";var s=e(941);f.exports={$id:"https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:s.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:s.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}},290:function(f,n,e){"use strict";var s=/^[a-z_$][a-z0-9_$-]*$/i;var l=e(323);var v=e(289);f.exports={add:addKeyword,get:getKeyword,remove:removeKeyword,validate:validateKeyword};function addKeyword(f,n){var e=this.RULES;if(e.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!s.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(n){this.validateKeyword(n,true);var v=n.type;if(Array.isArray(v)){for(var r=0;r<v.length;r++)_addRule(f,v[r],n)}else{_addRule(f,v,n)}var g=n.metaSchema;if(g){if(n.$data&&this._opts.$data){g={anyOf:[g,{$ref:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#"}]}}n.validateSchema=this.compile(g,true)}}e.keywords[f]=e.all[f]=true;function _addRule(f,n,s){var v;for(var r=0;r<e.length;r++){var g=e[r];if(g.type==n){v=g;break}}if(!v){v={type:n,rules:[]};e.push(v)}var b={keyword:f,definition:s,custom:true,code:l,implements:s.implements};v.rules.push(b);e.custom[f]=b}return this}function getKeyword(f){var n=this.RULES.custom[f];return n?n.definition:this.RULES.keywords[f]||false}function removeKeyword(f){var n=this.RULES;delete n.keywords[f];delete n.all[f];delete n.custom[f];for(var e=0;e<n.length;e++){var s=n[e].rules;for(var l=0;l<s.length;l++){if(s[l].keyword==f){s.splice(l,1);break}}}return this}function validateKeyword(f,n){validateKeyword.errors=null;var e=this._validateKeyword=this._validateKeyword||this.compile(v,true);if(e(f))return true;validateKeyword.errors=e.errors;if(n)throw new Error("custom keyword definition is invalid: "+this.errorsText(e.errors));else return false}},312:function(f){f.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:false}},323:function(f){"use strict";f.exports=function generate_custom(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w;var j="data"+(v||"");var E="valid"+l;var R="errs__"+l;var A=f.opts.$data&&r&&r.$data,F;if(A){s+=" var schema"+l+" = "+f.util.getData(r.$data,v,f.dataPathArr)+"; ";F="schema"+l}else{F=r}var p=this,I="definition"+l,x=p.definition,z="";var U,N,Q,q,c;if(A&&x.$data){c="keywordValidate"+l;var C=x.validateSchema;s+=" var "+I+" = RULES.custom['"+n+"'].definition; var "+c+" = "+I+".validate;"}else{q=f.useCustomRule(p,r,f.schema,f);if(!q)return;F="validate.schema"+g;c=q.code;U=x.compile;N=x.inline;Q=x.macro}var O=c+".errors",L="i"+l,J="ruleErr"+l,G=x.async;if(G&&!f.async)throw new Error("async keyword in sync schema");if(!(N||Q)){s+=""+O+" = null;"}s+="var "+R+" = errors;var "+E+";";if(A&&x.$data){z+="}";s+=" if ("+F+" === undefined) { "+E+" = true; } else { ";if(C){z+="}";s+=" "+E+" = "+I+".validateSchema("+F+"); if ("+E+") { "}}if(N){if(x.statements){s+=" "+q.validate+" "}else{s+=" "+E+" = "+q.validate+"; "}}else if(Q){var T=f.util.copy(f);var z="";T.level++;var H="valid"+T.level;T.schema=q.validate;T.schemaPath="";var X=f.compositeRule;f.compositeRule=T.compositeRule=true;var M=f.validate(T).replace(/validate\.schema/g,c);f.compositeRule=T.compositeRule=X;s+=" "+M}else{var Y=Y||[];Y.push(s);s="";s+=" "+c+".call( ";if(f.opts.passContext){s+="this"}else{s+="self"}if(U||x.schema===false){s+=" , "+j+" "}else{s+=" , "+F+" , "+j+" , validate.schema"+f.schemaPath+" "}s+=" , (dataPath || '')";if(f.errorPath!='""'){s+=" + "+f.errorPath}var W=v?"data"+(v-1||""):"parentData",B=v?f.dataPathArr[v]:"parentDataProperty";s+=" , "+W+" , "+B+" , rootData ) ";var Z=s;s=Y.pop();if(x.errors===false){s+=" "+E+" = ";if(G){s+="await "}s+=""+Z+"; "}else{if(G){O="customErrors"+l;s+=" var "+O+" = null; try { "+E+" = await "+Z+"; } catch (e) { "+E+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "}else{s+=" "+O+" = null; "+E+" = "+Z+"; "}}}if(x.modifying){s+=" if ("+W+") "+j+" = "+W+"["+B+"];"}s+=""+z;if(x.valid){if(d){s+=" if (true) { "}}else{s+=" if ( ";if(x.valid===undefined){s+=" !";if(Q){s+=""+H}else{s+=""+E}}else{s+=" "+!x.valid+" "}s+=") { ";w=p.keyword;var Y=Y||[];Y.push(s);s="";var Y=Y||[];Y.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+(w||"custom")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { keyword: '"+p.keyword+"' } ";if(f.opts.messages!==false){s+=" , message: 'should pass \""+p.keyword+"\" keyword validation' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+j+" "}s+=" } "}else{s+=" {} "}var D=s;s=Y.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+D+"]); "}else{s+=" validate.errors = ["+D+"]; return false; "}}else{s+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}var K=s;s=Y.pop();if(N){if(x.errors){if(x.errors!="full"){s+=" for (var "+L+"="+R+"; "+L+"<errors; "+L+"++) { var "+J+" = vErrors["+L+"]; if ("+J+".dataPath === undefined) "+J+".dataPath = (dataPath || '') + "+f.errorPath+"; if ("+J+".schemaPath === undefined) { "+J+'.schemaPath = "'+b+'"; } ';if(f.opts.verbose){s+=" "+J+".schema = "+F+"; "+J+".data = "+j+"; "}s+=" } "}}else{if(x.errors===false){s+=" "+K+" "}else{s+=" if ("+R+" == errors) { "+K+" } else { for (var "+L+"="+R+"; "+L+"<errors; "+L+"++) { var "+J+" = vErrors["+L+"]; if ("+J+".dataPath === undefined) "+J+".dataPath = (dataPath || '') + "+f.errorPath+"; if ("+J+".schemaPath === undefined) { "+J+'.schemaPath = "'+b+'"; } ';if(f.opts.verbose){s+=" "+J+".schema = "+F+"; "+J+".data = "+j+"; "}s+=" } } "}}}else if(Q){s+=" var err = ";if(f.createErrors!==false){s+=" { keyword: '"+(w||"custom")+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { keyword: '"+p.keyword+"' } ";if(f.opts.messages!==false){s+=" , message: 'should pass \""+p.keyword+"\" keyword validation' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+j+" "}s+=" } "}else{s+=" {} "}s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(vErrors); "}else{s+=" validate.errors = vErrors; return false; "}}}else{if(x.errors===false){s+=" "+K+" "}else{s+=" if (Array.isArray("+O+")) { if (vErrors === null) vErrors = "+O+"; else vErrors = vErrors.concat("+O+"); errors = vErrors.length; for (var "+L+"="+R+"; "+L+"<errors; "+L+"++) { var "+J+" = vErrors["+L+"]; if ("+J+".dataPath === undefined) "+J+".dataPath = (dataPath || '') + "+f.errorPath+"; "+J+'.schemaPath = "'+b+'"; ';if(f.opts.verbose){s+=" "+J+".schema = "+F+"; "+J+".data = "+j+"; "}s+=" } } else { "+K+" } "}}s+=" } ";if(d){s+=" else { "}}return s}},330:function(f){"use strict";f.exports=function generate_items(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w="data"+(v||"");var j="valid"+l;var E="errs__"+l;var R=f.util.copy(f);var A="";R.level++;var F="valid"+R.level;var p="i"+l,I=R.dataLevel=f.dataLevel+1,x="data"+I,z=f.baseId;s+="var "+E+" = errors;var "+j+";";if(Array.isArray(r)){var U=f.schema.additionalItems;if(U===false){s+=" "+j+" = "+w+".length <= "+r.length+"; ";var N=b;b=f.errSchemaPath+"/additionalItems";s+=" if (!"+j+") { ";var Q=Q||[];Q.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+"additionalItems"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: { limit: "+r.length+" } ";if(f.opts.messages!==false){s+=" , message: 'should NOT have more than "+r.length+" items' "}if(f.opts.verbose){s+=" , schema: false , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}var q=s;s=Q.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+q+"]); "}else{s+=" validate.errors = ["+q+"]; return false; "}}else{s+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } ";b=N;if(d){A+="}";s+=" else { "}}var c=r;if(c){var C,O=-1,L=c.length-1;while(O<L){C=c[O+=1];if(f.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0:f.util.schemaHasRules(C,f.RULES.all)){s+=" "+F+" = true; if ("+w+".length > "+O+") { ";var J=w+"["+O+"]";R.schema=C;R.schemaPath=g+"["+O+"]";R.errSchemaPath=b+"/"+O;R.errorPath=f.util.getPathExpr(f.errorPath,O,f.opts.jsonPointers,true);R.dataPathArr[I]=O;var G=f.validate(R);R.baseId=z;if(f.util.varOccurences(G,x)<2){s+=" "+f.util.varReplace(G,x,J)+" "}else{s+=" var "+x+" = "+J+"; "+G+" "}s+=" } ";if(d){s+=" if ("+F+") { ";A+="}"}}}}if(typeof U=="object"&&(f.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0:f.util.schemaHasRules(U,f.RULES.all))){R.schema=U;R.schemaPath=f.schemaPath+".additionalItems";R.errSchemaPath=f.errSchemaPath+"/additionalItems";s+=" "+F+" = true; if ("+w+".length > "+r.length+") { for (var "+p+" = "+r.length+"; "+p+" < "+w+".length; "+p+"++) { ";R.errorPath=f.util.getPathExpr(f.errorPath,p,f.opts.jsonPointers,true);var J=w+"["+p+"]";R.dataPathArr[I]=p;var G=f.validate(R);R.baseId=z;if(f.util.varOccurences(G,x)<2){s+=" "+f.util.varReplace(G,x,J)+" "}else{s+=" var "+x+" = "+J+"; "+G+" "}if(d){s+=" if (!"+F+") break; "}s+=" } } ";if(d){s+=" if ("+F+") { ";A+="}"}}}else if(f.opts.strictKeywords?typeof r=="object"&&Object.keys(r).length>0:f.util.schemaHasRules(r,f.RULES.all)){R.schema=r;R.schemaPath=g;R.errSchemaPath=b;s+=" for (var "+p+" = "+0+"; "+p+" < "+w+".length; "+p+"++) { ";R.errorPath=f.util.getPathExpr(f.errorPath,p,f.opts.jsonPointers,true);var J=w+"["+p+"]";R.dataPathArr[I]=p;var G=f.validate(R);R.baseId=z;if(f.util.varOccurences(G,x)<2){s+=" "+f.util.varReplace(G,x,J)+" "}else{s+=" var "+x+" = "+J+"; "+G+" "}if(d){s+=" if (!"+F+") break; "}s+=" }"}if(d){s+=" "+A+" if ("+E+" == errors) {"}s=f.util.cleanUpCode(s);return s}},334:function(f){"use strict";f.exports=function generate_contains(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w="data"+(v||"");var j="valid"+l;var E="errs__"+l;var R=f.util.copy(f);var A="";R.level++;var F="valid"+R.level;var p="i"+l,I=R.dataLevel=f.dataLevel+1,x="data"+I,z=f.baseId,U=f.opts.strictKeywords?typeof r=="object"&&Object.keys(r).length>0:f.util.schemaHasRules(r,f.RULES.all);s+="var "+E+" = errors;var "+j+";";if(U){var N=f.compositeRule;f.compositeRule=R.compositeRule=true;R.schema=r;R.schemaPath=g;R.errSchemaPath=b;s+=" var "+F+" = false; for (var "+p+" = 0; "+p+" < "+w+".length; "+p+"++) { ";R.errorPath=f.util.getPathExpr(f.errorPath,p,f.opts.jsonPointers,true);var Q=w+"["+p+"]";R.dataPathArr[I]=p;var q=f.validate(R);R.baseId=z;if(f.util.varOccurences(q,x)<2){s+=" "+f.util.varReplace(q,x,Q)+" "}else{s+=" var "+x+" = "+Q+"; "+q+" "}s+=" if ("+F+") break; } ";f.compositeRule=R.compositeRule=N;s+=" "+A+" if (!"+F+") {"}else{s+=" if ("+w+".length == 0) {"}var c=c||[];c.push(s);s="";if(f.createErrors!==false){s+=" { keyword: '"+"contains"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: {} ";if(f.opts.messages!==false){s+=" , message: 'should contain a valid item' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}var C=s;s=c.pop();if(!f.compositeRule&&d){if(f.async){s+=" throw new ValidationError(["+C+"]); "}else{s+=" validate.errors = ["+C+"]; return false; "}}else{s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}s+=" } else { ";if(U){s+=" errors = "+E+"; if (vErrors !== null) { if ("+E+") vErrors.length = "+E+"; else vErrors = null; } "}if(f.opts.allErrors){s+=" } "}s=f.util.cleanUpCode(s);return s}},357:function(f){f.exports=require("assert")},398:function(f){"use strict";f.exports=function generate_anyOf(f,n,e){var s=" ";var l=f.level;var v=f.dataLevel;var r=f.schema[n];var g=f.schemaPath+f.util.getProperty(n);var b=f.errSchemaPath+"/"+n;var d=!f.opts.allErrors;var w="data"+(v||"");var j="valid"+l;var E="errs__"+l;var R=f.util.copy(f);var A="";R.level++;var F="valid"+R.level;var p=r.every(function(n){return f.opts.strictKeywords?typeof n=="object"&&Object.keys(n).length>0:f.util.schemaHasRules(n,f.RULES.all)});if(p){var I=R.baseId;s+=" var "+E+" = errors; var "+j+" = false; ";var x=f.compositeRule;f.compositeRule=R.compositeRule=true;var z=r;if(z){var U,N=-1,Q=z.length-1;while(N<Q){U=z[N+=1];R.schema=U;R.schemaPath=g+"["+N+"]";R.errSchemaPath=b+"/"+N;s+=" "+f.validate(R)+" ";R.baseId=I;s+=" "+j+" = "+j+" || "+F+"; if (!"+j+") { ";A+="}"}}f.compositeRule=R.compositeRule=x;s+=" "+A+" if (!"+j+") { var err = ";if(f.createErrors!==false){s+=" { keyword: '"+"anyOf"+"' , dataPath: (dataPath || '') + "+f.errorPath+" , schemaPath: "+f.util.toQuotedString(b)+" , params: {} ";if(f.opts.messages!==false){s+=" , message: 'should match some schema in anyOf' "}if(f.opts.verbose){s+=" , schema: validate.schema"+g+" , parentSchema: validate.schema"+f.schemaPath+" , data: "+w+" "}s+=" } "}else{s+=" {} "}s+="; if (