!function(a,b){"function"==typeofdefine&&define.amd?define([],b):"undefined"!=typeofmodule&&module.exports?module.exports=b():a.tv4=b()}(this,function(){functiona(a){returnencodeURI(a).replace(/%25[0-9][0-9]/g,function(a){return"%"+a.substring(3)})}functionb(b){varc="";l[b.charAt(0)]&&(c=b.charAt(0),b=b.substring(1));vard="",e="",f=!0,g=!1,h=!1;"+"===c?f=!1:"."===c?(e=".",d="."):"/"===c?(e="/",d="/"):"#"===c?(e="#",f=!1):";"===c?(e=";",d=";",g=!0,h=!0):"?"===c?(e="?",d="&",g=!0):"&"===c&&(e="&",d="&",g=!0);for(vari=[],j=b.split(","),k=[],n={},o=0;o<j.length;o++){varp=j[o],q=null;if(-1!==p.indexOf(":")){varr=p.split(":");p=r[0],q=parseInt(r[1],10)}for(vars={};m[p.charAt(p.length-1)];)s[p.charAt(p.length-1)]=!0,p=p.substring(0,p.length-1);vart={truncate:q,name:p,suffices:s};k.push(t),n[p]=t,i.push(p)}varu=function(b){for(varc="",i=0,j=0;j<k.length;j++){varl=k[j],m=b(l.name);if(null===m||void0===m||Array.isArray(m)&&0===m.length||"object"==typeofm&&0===Object.keys(m).length)i++;elseif(c+=j===i?e:d||",",Array.isArray(m)){g&&(c+=l.name+"=");for(varn=0;n<m.length;n++)n>0&&(c+=l.suffices["*"]?d||",":",",l.suffices["*"]&&g&&(c+=l.name+"=")),c+=f?encodeURIComponent(m[n]).replace(/!/g,"%21"):a(m[n])}elseif("object"==typeofm){g&&!l.suffices["*"]&&(c+=l.name+"=");varo=!0;for(varpinm)o||(c+=l.suffices["*"]?d||",":","),o=!1,c+=f?encodeURIComponent(p).replace(/!/g,"%21"):a(p),c+=l.suffices["*"]?"=":",",c+=f?encodeURIComponent(m[p]).replace(/!/g,"%21"):a(m[p])}elseg&&(c+=l.name,h&&""===m||(c+="=")),null!=l.truncate&&(m=m.substring(0,l.truncate)),c+=f?encodeURIComponent(m).replace(/!/g,"%21"):a(m)}returnc};returnu.varNames=i,{prefix:e,substitution:u}}functionc(a){if(!(thisinstanceofc))returnnewc(a);for(vard=a.split("{"),e=[d.shift()],f=[],g=[],h=[];d.length>0;){vari=d.shift(),j=i.split("}")[0],k=i.substring(j.length+1),l=b(j);g.push(l.substitution),f.push(l.prefix),e.push(k),h=h.concat(l.substitution.varNames)}this.fill=function(a){for(varb=e[0],c=0;c<g.length;c++){vard=g[c];b+=d(a),b+=e[c+1]}returnb},this.varNames=h,this.template=a}functiond(a,b){if(a===b)return!0;if("object"==typeofa&&"object"==typeofb){if(Array.isArray(a)!==Array.isArray(b))return!1;if(Array.isArray(a)){if(a.length!==b.length)return!1;for(varc=0;c<a.length;c++)if(!d(a[c],b[c]))return!1}else{vare;for(eina)if(void0===b[e]&&void0!==a[e])return!1;for(einb)if(void0===a[e]&&void0!==b[e])return!1;for(eina)if(!d(a[e],b[e]))return!1}return!0}return!1}functione(a){varb=String(a).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);returnb?{href:b[0]||"",protocol:b[1]||"",authority:b[2]||"",host:b[3]||"",hostname:b[4]||"",port:b[5]||"",pathname:b[6]||"",search:b[7]||"",hash:b[8]||""}:null}functionf(a,b){functionc(a){varb=[];returna.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(a){"/.."===a?b.pop():b.push(a)}),b.join("").replace(/^\//,"/"===a.charAt(0)?"/":"")}returnb=e(b||""),a=e(a||""),b&&a?(b.protocol||a.protocol)+(b.protocol||b.authority?b.authority:a.authority)+c(b.protocol||b.authority||"/"===b.pathname.charAt(0)?b.pathname:b.pathname?(a.authority&&!a.pathname?"/":"")+a.pathname.slice(0,a.pathname.lastIndexOf("/")+1)+b.pathname:a.pathname)+(b.protocol||b.authority||b.pathname?b.search:b.search||a.search)+b.hash:null}functiong(a){returna.split("#")[0]}functionh(a,b){if(a&&"object"==typeofa)if(void0===b?b=a.id:"string"==typeofa.id&&(b=f(b,a.id),a.id=b),Array.isArray(a))for(varc=0;c<a.length;c++)h(a[c],b);else{"string"==typeofa.$ref&&(a.$ref=f(b,a.$ref));for(vardina)"enum"!==d&&h(a[d],b)}}functioni(a,b,c,d,e,f){if(Error.call(this),void0===a)thrownewError("No code supplied for error: "+b);this.message=b,this.params=c,this.code=a,this.dataPath=d||"",this.schemaPath=e||"",this.subErrors=f||null;varg=newError(this.message);if(this.stack=g.stack||g.stacktrace,!this.stack)try{throwg}catch(g){this.stack=g.stack||g.stacktrace}}functionj(a,b){if(b.substring(0,a.length)===a){varc=b.substring(a.length);if(b.length>0&&"/"===b.charAt(a.length-1)||"#"===c.charAt(0)||"?"===c.charAt(0))return!0}return!1}functionk(a){varb=newn,c=a||"en",d={addFormat:function(){b.addFormat.apply(b,arguments)},language:function(a){returna?(s[a]||(a=a.split("-")[0]),s[a]?(c=a,a):!1):c},addLanguage:function(a,b){varc;for(cino)b[c]&&!b[o[c]]&&(b[o[c]]=b[c]);vard=a.split("-")[0];if(s[d]){s[a]=Object.create(s[d]);for(cinb)"undefined"==typeofs[d][c]&&(s[d][c]=b[c]),s[a][c]=b[c]}elses[a]=b,s[d]=b;returnthis},freshApi:function(a){varb=k();returna&&b.language(a),b},validate:function(a,d,e,f){varg=newn(b,!1,s[c],e,f);"string"==typeofd&&(d={$ref:d}),g.addSchema("",d);varh=g.validateAll(a,d,null,null,"");return!h&&f&&(h=g.banUnknownProperties()),this.error=h,this.missing=g.missing,this.valid=null===h,this.valid},validateResult:function(){vara={};returnthis.validate.apply(a,arguments),a},validateMultiple:function(a,d,e,f){varg=newn(b,!0,s[c],e,f);"string"==typeofd&&(d={$ref:d}),g.addSchema("",d),g.validateAll(a,d,null,null,""),f&&g.banUnknownProperties();varh={};returnh.errors=g.errors,h.missing=g.missing,h.valid=0===h.errors.length,h},addSchema:function(){returnb.addSchema.apply(b,arguments)},getSchema:function(){returnb.getSchema.apply(b,arguments)},getSchemaMap:function(){returnb.getSchemaMap.apply(b,arguments)},getSchemaUris:function(){returnb.getSchemaUris.apply(b,arguments)},getMissingUris:function(){returnb.getMissingUris.apply(b,arguments)},dropSchemas:function(){b.dropSchemas.apply(b,arguments)},defineKeyword:function(){b.defineKeyword.apply(b,arguments)},defineError:function(a,b,c){if("string"!=typeofa||!/^[A-Z]+(_[A-Z]+)*$/.test(a))thrownewError("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if("number"!=typeofb||b%1!==0||1e4>b)thrownewError("Code number must be an integer > 10000");if("undefined"!=typeofo[a])thrownewError("Error already defined: "+a+" as "+o[a]);if("undefined"!=typeofp[b])thrownewError("Error code already used: "+p[b]+" as "+b);o[a]=b,p[b]=a,r[a]=r[b]=c;for(vardins){vare=s[d];e[a]&&(e[b]=e[b]||e[a])}},reset:function(){b.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:h,resolveUrl:f,getDocumentUri:g,errorCodes:o};returnd}Object.keys||(Object.keys=function(){vara=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;returnfunction(e){if("object"!=typeofe&&"function"!=typeofe||null===e)thrownewTypeError("Object.keys called on non-object");varf=[];for(vargine)a.call(e,g)&&f.push(g);if(b)for(varh=0;d>h;h++)a.call(e,c[h])&&f.push(c[h]);returnf}}()),Object.create||(Object.create=function(){functiona(){}returnfunction(b){if(1!==arguments.length)thrownewError("Object.create implementation only accepts one parameter.");returna.prototype=b,newa}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null===this)thrownewTypeError;varb=Object(this),c=b.length>>>0;if(0===c)return-1;vard=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!==d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(vare=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(einb&&b[e]===a)returne;return-1}),Object.isFrozen||(Object.isFrozen=function(a){for(varb="tv4_test_frozen_key";a.hasOwnProperty(b);)b+=Math.random();try{returna[b]=!0,deletea[b],!1}catch(c){return!0}});varl={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},m={"*":!0};c.prototype={toString:function(){returnthis.template},fillFromObject:function(a){returnthis.fill(function(b){returna[b]})}};varn=function(a,b,c,d,e){if(this.missing=[],this.missingMap={},this.formatValidators=a?Object.create(a.formatValidators):{},this.schemas=a?Object.create(a.schemas):{},this.collectMultiple=b,this.errors=[],this.handleError=b?this.collectError:this.returnError,d&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),e&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorMessages=c,this.definedKeywords={},a)for(varfina.definedKeywords)this.definedKeywords[f]=a.definedKeywords[f].slice(0)};n.prototype.defineKeyword=function(a,b){this.definedKeywords[a]=this.definedKeywords[a]||[],this.definedKeywords[a].push(b)},n.prototype.createError=function(a,b,c,d,e){varf=this.errorMessages[a]||r[a];if("string"!=typeoff)returnnewi(a,"Unknown error code "+a+": "+JSON.stringify(b),b,c,d,e);varg=f.replace(/\{([^{}]*)\}/g,function(a,c){vard=b[c];return"string"==typeofd||"number"==typeofd?d:a});returnnewi(a,g,b,c,d,e)},n.prototype.returnError=function(a){returna},n.prototype.collectError=function(a){returna&&this.errors.push(a),null},n.prototype.prefixErrors=function(a,b,c){for(vard=a;d<this.errors.length;d++)this.errors[d]=this.errors[d].prefixWith(b,c);returnthis},n.prototype.banUnknownProperties=function(){for(varainthis.unknownPropertyPaths){varb=this.createError(o.UNKNOWN_PROPERTY,{path:a},a,""),c=this.handleError(b);if(c)returnc}returnnull},n.prototype.addFormat=function(a,b){if("object"==typeofa){for(varcina)this.addFormat(c,a[c]);returnthis}this.formatValidators[a]=b},n.prototype.resolveRefs=function(a,b){if(void0!==a.$ref){if(b=b||{},b[a.$ref])returnthis.createError(o.CIRCULAR_REFERENCE,{urls:Object.keys(b).join(", ")},"","");b[a.$ref]=!0,a=this.getSchema(a.$ref,b)}returna},n.prototype.getSchema=function(a,b){varc;if(void0!==this.schemas[a])returnc=this.schemas[a],this.resolveRefs(c,b);vard=a,e="";if(-1!==a.indexOf("#")&&(e=a.substring(a.indexOf("#")+1),d=a.substring(0,a.indexOf("#"))),"object"==typeofthis.schemas[d]){c=this.schemas[d];varf=decodeURIComponent(e);if(""===f)returnthis.resolveRefs(c,b);if("/"!==f.charAt(0))returnvoid0;for(varg=f.split("/").slice(1),h=0;h<g.length;h++){vari=g[h].replace(/~1/g,"/").replace(/~0/g,"~");if(void0===c[i]){c=void0;break}c=c[i]}if(void0!==c)returnthis.resolveRefs(c,b)}void0===this.missing[d]&&(this.missing.push(d),this.missing[d]=d,this.missingMap[d]=d)},n.prototype.searchSchemas=function(a,b){if(a&&"object"==typeofa){"string"==typeofa.id&&j(b,a.id)&&void0===this.schemas[a.id]&&(this.schemas[a.id]=a);for(varcina)if("enum"!==c)if("object"==typeofa[c])this.searchSchemas(a[c],b);elseif("$ref"===c){vard=g(a[c]);d&&void0===this.schemas[d]&&void0===this.missingMap[d]&&(this.missingMap[d]=d)}}},n.prototype.addSchema=function(a,b){if("string"!=typeofa||"undefined"==typeofb){if("object"!=typeofa||"string"!=typeofa.id)return;b=a,a=b.id}a===g(a)+"#"&&(a=g(a)),this.schemas[a]=b,deletethis.missingMap[a],h(b,a),this.searchSchemas(b,a)},n.prototype.getSchemaMap=function(){vara={};for(varbinthis.schemas)a[b]=this.schemas[b];returna},n.prototype.getSchemaUris=function(a){varb=[];for(varcinthis.schemas)(!a||a.test(c))&&b.push(c);returnb},n.prototype.getMissingUris=function(a){varb=[];for(varcinthis.missingMap)(!a||a.test(c))&&b.push(c);returnb},n.prototype.dropSchemas=function(){this.schemas={},this.reset()},n.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},n.prototype.validateAll=function(a,b,c,d,e){varf;if(b=this.resolveRefs(b),!b)returnnull;if(binstanceofi)returnthis.errors.push(b),b;varg,h=this.errors.length,j=null,k=null;if(this.checkRecursive&&a&&"object"==typeofa){if(f=!this.scanned.length,a[this.validatedSchemasKey]){varl=a[this.validatedSchemasKey].indexOf(b);if(-1!==l)returnthis.errors=this.errors.concat(a[this.validationErrorsKey][l]),null}if(Object.isFrozen(a)&&(g=this.scannedFrozen.indexOf(a),-1!==g)){varm=this.scannedFrozenSchemas[g].indexOf(b);if(-1!==m)returnthis.errors=this.errors.concat(this.scannedFrozenValidationErrors[g][m]),null}if(this.scanned.push(a),Object.isFrozen(a))-1===g&&(g=this.scannedFrozen.length,this.scannedFrozen.push(a),this.scannedFrozenSchemas.push([])),j=this.scannedFrozenSchemas[g].length,this.scannedFrozenSchemas[g][j]=b,this.scannedFrozenValidationErrors[g][j]=[];else{if(!a[this.validatedSchemasKey])try{Object.defineProperty(a,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(a,this.validationErrorsKey,{value:[],configurable:!0})}catch(n){a[this.validatedSchemasKey]=[],a[this.validationErrorsKey]=[]}k=a[this.validatedSchemasKey].length,a[this.validatedSchemasKey][k]=b,a[this.validationErrorsKey][k]=[]}}varo=this.errors.length,p=this.validateBasic(a,b,e)||this.validateNumeric(a,b,e)||this.validateString(a,b,e)||this.validateArray(a,b,e)||this.validateObject(a,b,e)||this.validateCombinations(a,b,e)||this.validateHypermedia(a,b,e)||this.validateFormat(a,b,e)||this.validateDefinedKeywords(a,b,e)||null;if(f){for(;this.scanned.length;){varq=this.scanned.pop();deleteq[this.validatedSchemasKey]}this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(p||o!==this.errors.length)for(;c&&c.length||d&&d.length;){varr=c&&c.length?""+c.pop():null,s=d&&d.length?""+d.pop():null;p&&(p=p.prefixWith(r,s)),this.prefixErrors(o,r,s)}returnnull!==j?this.scannedFrozenValidationErrors[g][j]=this.errors.slice(h):null!==k&&(a[this.validationErrorsKey][k]=this.errors.slice(h)),this.handleError(p)},n.prototype.validateFormat=function(a,b){if("string"!=typeofb.format||!this.formatValidators[b.format])returnnull;varc=this.formatValidators[b.format].call(null,a,b);return"string"==typeofc||"number"==typeofc?this.createError(o.FORMAT_CUSTOM,{message:c}).prefixWith(null,"format"):c&&"object"==typeofc?this.createError(o.FORMAT_CUSTOM,{message:c.message||"?"},c.dataPath||null,c.schemaPath||"/format"):null},n.prototype.validateDefinedKeywords=function(a,b){for(varcinthis.definedKeywords)if("undefined"!=typeofb[c])for(vard=this.definedKeywords[c],e=0;e<d.length;e++){varf=d[e],g=f(a,b[c],b);if("string"==typeofg||"number"==typeofg)returnthis.createError(o.KEYWORD_CUSTOM,{key:c,message:g}).prefixWith(null,"format");if(g&&"object"==typeofg){varh=g.code||o.KEYWORD_CUSTOM;if("string"==typeofh){if(!o[h])thrownewError("Undefined error code (use defineError): "+h);h=o[h]}vari="object"==typeofg.message?g.message:{key:c,message:g.message||"?"},j=g.schemaPath||"/"+c.replace(/~/g,"~0").replace(/\//g,"~1");returnthis.createError(h,i,g.dataPath||null,j)}}returnnull},n.prototype.validateBasic=function(a,b,c){vard;return(d=this.validateType(a,b,c))?d.prefixWith(null,"type"):(d=this.validateEnum(a,b,c))?d.prefixWith(null,"type"):null},n.prototype.validateType=function(a,b){if(void0===b.type)returnnull;varc=typeofa;null===a?c="null":Array.isArray(a)&&(c="array");vard=b.type;"object"!=typeofd&&(d=[d]);for(vare=0;e<d.length;e++){varf=d[e];if(f===c||"integer"===f&&"number"===c&&a%1===0)returnnull}returnthis.createError(o.INVALID_TYPE,{type:c,expected:d.join("/")})},n.prototype.validateEnum=function(a,b){if(void0===b["enum"])returnnull;for(varc=0;c<b["enum"].length;c++){vare=b["enum"][c];if(d(a,e))returnnull}returnthis.createError(o.ENUM_MISMATCH,{value:"undefined"!=typeofJSON?JSON.stringify(a):a})},n.prototype.validateNumeric=function(a,b,c){returnthis.validateMultipleOf(a,b,c)||this.validateMinMax(a,b,c)||null},n.prototype.validateMultipleOf=function(a,b){varc=b.multipleOf||b.divisibleBy;returnvoid0===c?null:"number"==typeofa&&a%c!==0?this.createError(o.NUMBER_MULTIPLE_OF,{value:a,multipleOf:c}):null},n.prototype.validateMinMax=function(a,b){if("number"!=typeofa)returnnull;if(void0!==b.minimum){if(a<b.minimum)returnthis.createError(o.NUMBER_MINIMUM,{value:a,minimum:b.minimum}).prefixWith(null,"minimum");if(b.exclusiveMinimum&&a===b.minimum)returnthis.createError(o.NUMBER_MINIMUM_EXCLUSIVE,{value:a,minimum:b.minimum}).prefixWith(null,"exclusiveMinimum")}if(void0!==b.maximum){if(a>b.maximum)returnthis.createError(o.NUMBER_MAXIMUM,{value:a,maximum:b.maximum}).prefixWith(null,"maximum");if(b.exclusiveMaximum&&a===b.maximum)returnthis.createError(o.NUMBER_MAXIMUM_EXCLUSIVE,{value:a,maximum:b.maximum}).prefixWith(null,"exclusiveMaximum")}returnnull},n.prototype.validateString=function(a,b,c){returnthis.validateStringLength(a,b,c)||this.validateStringPattern(a,b,c)||null},n.prototype.validateStringLength=function(a,b){return"string"!=typeofa?null:void0!==b.minLength&&a.length<b.minLength?this.createError(o.STRING_LENGTH_SHORT,{length:a.length,minimum:b.minLength}).prefixWith(null,"minLength"):void0!==b.maxLength&&a.length>b.maxLength?this.createError(o.STRING_LENGTH_LONG,{length:a.length,maximum:b.maxLength}).prefixWith(null,"maxLength"):null},n.prototype.validateStringPattern=function(a,b){if("string"!=typeofa||void0===b.pattern)returnnull;varc=newRegExp(b.pattern);returnc.test(a)?null:this.createError(o.STRING_PATTERN,{pattern:b.pattern}).prefixWith(null,"pattern")},n.prototype.validateArray=function(a,b,c){returnArray.isArray(a)?this.validateArrayLength(a,b,c)||this.validateArrayUniqueItems(a,b,c)||this.validateArrayItems(a,b,c)||null:null},n.prototype.validateArrayLength=function(a,b){varc;returnvoid0!==b.minItems&&a.length<b.minItems&&(c=this.createError(o.ARRAY_LENGTH_SHORT,{length:a.length,minimum:b.minItems}).prefixWith(null,"minItems"),this.handleError(c))?c:void0!==b.maxItems&&a.length>b.maxItems&&(c=this.createError(o.ARRAY_LENGTH_LONG,{length:a.length,maximum:b.maxItems}).prefixWith(null,"maxItems"),this.handleError(c))?c:null},n.prototype.validateArrayUniqueItems=function(a,b){if(b.uniqueItems)for(varc=0;c<a.length;c++)for(vare=c+1;e<a.length;e++)if(d(a[c],a[e])){varf=this.createError(o.ARRAY_UNIQUE,{match1:c,match2:e}).prefixWith(null,"uniqueItems");if(this.handleError(f))returnf}returnnull},n.prototype.validateArrayItems=function(a,b,c){if(void0===b.items)returnnull;vard,e;if(Array.isArray(b.items)){for(e=0;e<a.length;e++)if(e<b.items.length){if(d=this.validateAll(a[e],b.items[e],[e],["items",e],c+"/"+e))returnd}elseif(void0!==b.additionalItems)if("boolean"==typeofb.additionalItems){if(!b.additionalItems&&(d=this.createError(o.ARRAY_ADDITIONAL_ITEMS,{}).prefixWith(""+e,"additionalItems"),this.handleError(d)))returnd}elseif(d=this.validateAll(a[e],b.additionalItems,[e],["additionalItems"],c+"/"+e))returnd}elsefor(e=0;e<a.length;e++)if(d=this.validateAll(a[e],b.items,[e],["items"],c+"/"+e))returnd;returnnull},n.prototype.validateObject=function(a,b,c){return"object"!=typeofa||null===a||Array.isArray(a)?null:this.validateObjectMinMaxProperties(a,b,c)||this.validateObjectRequiredProperties(a,b,c)||this.validateObjectProperties(a,b,c)||this.validateObjectDependencies(a,b,c)||null},n.prototype.validateObjectMinMaxProperties=function(a,b){varc,d=Object.keys(a);returnvoid0!==b.minProperties&&d.length<b.minProperties&&(c=this.createError(o.OBJECT_PROPERTIES_MINIMUM,{propertyCount:d.length,minimum:b.minProperties}).prefixWith(null,"minProperties"),this.handleError(c))?c:void0!==b.maxProperties&&d.length>b.maxProperties&&(c=this.createError(o.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:d.length,maximum:b.maxProperties}).prefixWith(null,"maxProperties"),this.handleError(c))?c:null},n.prototype.validateObjectRequiredProperties=function(a,b){if(void0!==b.required)for(varc=0;c<b.required.length;c++){vard=b.required[c];if(void0===a[d]){vare=this.createError(o.OBJECT_REQUIRED,{key:d}).prefixWith(null,""+c).prefixWith(null,"required");if(this.handleError(e))returne}}returnnull},n.prototype.validateObjectProperties=function(a,b,c){vard;for(vareina){varf=c+"/"+e.replace(/~/g,"~0").replace(/\//g,"~1"),g=!1;if(void0!==b.properties&&void0!==b.properties[e]&&(g=!0,d=this.validateAll(a[e],b.properties[e],[e],["properties",e],f)))returnd;if(void0!==b.patternProperties)for(varhinb.patternProperties){vari=newRegExp(h);if(i.test(e)&&(g=!0,d=this.validateAll(a[e],b.patternProperties[h],[e],["patternProperties",h],f)))returnd}if(g)this.trackUnknownProperties&&(this.knownPropertyPaths[f]=!0,deletethis.unknownPropertyPaths[f]);elseif(void0!==b.additionalProperties){if(this.trackUnknownProperties&&(this.knownPropertyPaths[f]=!0,deletethis.unknownPropertyPaths[f]),"boolean"==typeofb.additionalProperties){if(!b.additionalProperties&&(d=this.createError(o.OBJECT_ADDITIONAL_PROPERTIES,{}).prefixWith(e,"additionalProperties"),this.handleError(d)))returnd}elseif(d=this.validateAll(a[e],b.additionalProperties,[e],["additionalProperties"],f))returnd}elsethis.trackUnknownProperties&&!this.knownPropertyPaths[f]&&(this.unknownPropertyPaths[f]=!0)}returnnull},n.prototype.validateObjectDependencies=function(a,b,c){vard;if(void0!==b.dependencies)for(vareinb.dependencies)if(void0!==a[e]){varf=b.dependencies[e];if("string"==typeoff){if(void0===a[f]&&(d=this.createError(o.OBJECT_DEPENDENCY_KEY,{key:e,missing:f}).prefixWith(null,e).prefixWith(null,"dependencies"),this.handleError(d)))returnd}elseif(Array.isArray(f))for(varg=0;g<f.length;g++){varh=f[g];if(void0===a[h]&&(d=this.createError(o.OBJECT_DEPENDENCY_KEY,{key:e,missing:h}).prefixWith(null,""+g).prefixWith(null,e).prefixWith(null,"dependencies"),this.handleError(d)))returnd}elseif(d=this.validateAll(a,f,[],["dependencies",e],c))returnd}returnnull},n.prototype.validateCombinations=function(a,b,c){returnthis.validateAllOf(a,b,c)||this.validateAnyOf(a,b,c)||this.validateOneOf(a,b,c)||this.validateNot(a,b,c)||null},n.prototype.validateAllOf=function(a,b,c){if(void0===b.allOf)returnnull;for(vard,e=0;e<b.allOf.length;e++){varf=b.allOf[e];if(d=this.validateAll(a,f,[],["allOf",e],c))returnd}returnnull},n.prototype.validateAnyOf=function(a,b,c){if(void0===b.anyOf)returnnull;vard,e,f=[],g=this.errors.length;this.trackUnknownProperties&&(d=this.unknownPropertyPaths,e=this.knownPropertyPaths);for(varh=!0,i=0;i<b.anyOf.length;i++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});varj=b.anyOf[i],k=this.errors.length,l=this.validateAll(a,j,[],["anyOf",i],c);if(null===l&&k===this.errors.length){if(this.errors=this.errors.slice(0,g),this.trackUnknownProperties){for(varminthis.knownPropertyPaths)e[m]=!0,deleted[m];for(varninthis.unknownPropertyPaths)e[n]||(d[n]=!0);h=!1;continue}returnnull}l&&f.push(l.prefixWith(null,""+i).prefixWith(null,"anyOf"))}returnthis.trackUnknownProperties&&(this.unknownPropertyPaths=d,this.knownPropertyPaths=e),h?(f=f.concat(this.errors.slice(g)),this.errors=this.errors.slice(0,g),this.createError(o.ANY_OF_MISSING,{},"","/anyOf",f)):void0},n.prototype.validateOneOf=function(a,b,c){if(void0===b.oneOf)returnnull;vard,e,f=null,g=[],h=this.errors.length;this.trackUnknownProperties&&(d=this.unknownPropertyPaths,e=this.knownPropertyPaths);for(vari=0;i<b.oneOf.length;i++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});varj=b.oneOf[i],k=this.errors.length,l=this.validateAll(a,j,[],["oneOf",i],c);if(null===l&&k===this.errors.length){if(null!==f)returnthis.errors=this.errors.slice(0,h),this.createError(o.ONE_OF_MULTIPLE,{index1:f,index2:i},"","/oneOf");if(f=i,this.trackUnknownProperties){for(varminthis.knownPropertyPaths)e[m]=!0,deleted[m];for(varninthis.unknownPropertyPaths)e[n]||(d[n]=!0)}}elsel&&g.push(l)}returnthis.trackUnknownProperties&&(this.unknownPropertyPaths=d,this.knownPropertyPaths=e),null===f?(g=g.concat(this.errors.slice(h)),this.errors=this.errors.slice(0,h),this.createError(o.ONE_OF_MISSING,{},"","/oneOf",g)):(this.errors=this.errors.slice(0,h),null)},n.prototype.validateNot=function(a,b,c){if(void0===b.not)returnnull;vard,e,f=this.errors.length;this.trackUnknownProperties&&(d=this.unknownPropertyPaths,e=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});varg=this.validateAll(a,b.not,null,null,c),h=this.errors.slice(f);returnthis.errors=this.errors.slice(0,f),this.trackUnknownProperties&&(this.unknownPropertyPaths=d,this.knownPropertyPaths=e),null===g&&0===h.length?this.createError(o.NOT_PASSED,{},"","/not"):null},n.prototype.validateHypermedia=function(a,b,d){if(!b.links)returnnull;for(vare,f=0;f<b.links.length;f++){varg=b.links[f];if("describedby"===g.rel){for(varh=newc(g.href),i=!0,j=0;j<h.varNames.length;j++)if(!(h.varNames[j]ina)){i=!1;break}if(i){vark=h.fillFromObject(a),l={$ref:k};if(e=this.validateAll(a,l,[],["links",f],d))returne}}}};varo={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},p={};for(varqino)p[o[q]]=q;varr={INVALID_TYPE:"invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.name="ValidationError",i.prototype.prefixWith=function(a,b){if(null!==a&&(a=a.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+a+this.dataPath),null!==b&&(b=b.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+b+this.schemaPath),null!==this.subErrors)for(varc=0;c<this.subErrors.length;c++)this.subErrors[c].prefixWith(a,b);returnthis};vars={},t=k();returnt.addLanguage("en-gb",r),t.tv4=t,t});