Path: blob/master/node_modules/ajv/dist/ajv.bundle.js
2591 views
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Ajv = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){1'use strict';234var Cache = module.exports = function Cache() {5this._cache = {};6};789Cache.prototype.put = function Cache_put(key, value) {10this._cache[key] = value;11};121314Cache.prototype.get = function Cache_get(key) {15return this._cache[key];16};171819Cache.prototype.del = function Cache_del(key) {20delete this._cache[key];21};222324Cache.prototype.clear = function Cache_clear() {25this._cache = {};26};2728},{}],2:[function(require,module,exports){29'use strict';3031var MissingRefError = require('./error_classes').MissingRef;3233module.exports = compileAsync;343536/**37* Creates validating function for passed schema with asynchronous loading of missing schemas.38* `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.39* @this Ajv40* @param {Object} schema schema object41* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped42* @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.43* @return {Promise} promise that resolves with a validating function.44*/45function compileAsync(schema, meta, callback) {46/* eslint no-shadow: 0 */47/* global Promise */48/* jshint validthis: true */49var self = this;50if (typeof this._opts.loadSchema != 'function')51throw new Error('options.loadSchema should be a function');5253if (typeof meta == 'function') {54callback = meta;55meta = undefined;56}5758var p = loadMetaSchemaOf(schema).then(function () {59var schemaObj = self._addSchema(schema, undefined, meta);60return schemaObj.validate || _compileAsync(schemaObj);61});6263if (callback) {64p.then(65function(v) { callback(null, v); },66callback67);68}6970return p;717273function loadMetaSchemaOf(sch) {74var $schema = sch.$schema;75return $schema && !self.getSchema($schema)76? compileAsync.call(self, { $ref: $schema }, true)77: Promise.resolve();78}798081function _compileAsync(schemaObj) {82try { return self._compile(schemaObj); }83catch(e) {84if (e instanceof MissingRefError) return loadMissingSchema(e);85throw e;86}878889function loadMissingSchema(e) {90var ref = e.missingSchema;91if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');9293var schemaPromise = self._loadingSchemas[ref];94if (!schemaPromise) {95schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);96schemaPromise.then(removePromise, removePromise);97}9899return schemaPromise.then(function (sch) {100if (!added(ref)) {101return loadMetaSchemaOf(sch).then(function () {102if (!added(ref)) self.addSchema(sch, ref, undefined, meta);103});104}105}).then(function() {106return _compileAsync(schemaObj);107});108109function removePromise() {110delete self._loadingSchemas[ref];111}112113function added(ref) {114return self._refs[ref] || self._schemas[ref];115}116}117}118}119120},{"./error_classes":3}],3:[function(require,module,exports){121'use strict';122123var resolve = require('./resolve');124125module.exports = {126Validation: errorSubclass(ValidationError),127MissingRef: errorSubclass(MissingRefError)128};129130131function ValidationError(errors) {132this.message = 'validation failed';133this.errors = errors;134this.ajv = this.validation = true;135}136137138MissingRefError.message = function (baseId, ref) {139return 'can\'t resolve reference ' + ref + ' from id ' + baseId;140};141142143function MissingRefError(baseId, ref, message) {144this.message = message || MissingRefError.message(baseId, ref);145this.missingRef = resolve.url(baseId, ref);146this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));147}148149150function errorSubclass(Subclass) {151Subclass.prototype = Object.create(Error.prototype);152Subclass.prototype.constructor = Subclass;153return Subclass;154}155156},{"./resolve":6}],4:[function(require,module,exports){157'use strict';158159var util = require('./util');160161var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;162var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];163var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;164var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;165var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;166var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;167// uri-template: https://tools.ietf.org/html/rfc6570168var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;169// For the source: https://gist.github.com/dperini/729294170// For test cases: https://mathiasbynens.be/demo/url-regex171// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.172// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;173var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;174var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;175var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;176var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;177var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;178179180module.exports = formats;181182function formats(mode) {183mode = mode == 'full' ? 'full' : 'fast';184return util.copy(formats[mode]);185}186187188formats.fast = {189// date: http://tools.ietf.org/html/rfc3339#section-5.6190date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,191// date-time: http://tools.ietf.org/html/rfc3339#section-5.6192time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,193'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,194// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js195uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,196'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,197'uri-template': URITEMPLATE,198url: URL,199// email (sources from jsen validator):200// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363201// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')202email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,203hostname: HOSTNAME,204// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html205ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,206// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses207ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,208regex: regex,209// uuid: http://tools.ietf.org/html/rfc4122210uuid: UUID,211// JSON-pointer: https://tools.ietf.org/html/rfc6901212// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A213'json-pointer': JSON_POINTER,214'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,215// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00216'relative-json-pointer': RELATIVE_JSON_POINTER217};218219220formats.full = {221date: date,222time: time,223'date-time': date_time,224uri: uri,225'uri-reference': URIREF,226'uri-template': URITEMPLATE,227url: URL,228email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,229hostname: HOSTNAME,230ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,231ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,232regex: regex,233uuid: UUID,234'json-pointer': JSON_POINTER,235'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,236'relative-json-pointer': RELATIVE_JSON_POINTER237};238239240function isLeapYear(year) {241// https://tools.ietf.org/html/rfc3339#appendix-C242return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);243}244245246function date(str) {247// full-date from http://tools.ietf.org/html/rfc3339#section-5.6248var matches = str.match(DATE);249if (!matches) return false;250251var year = +matches[1];252var month = +matches[2];253var day = +matches[3];254255return month >= 1 && month <= 12 && day >= 1 &&256day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);257}258259260function time(str, full) {261var matches = str.match(TIME);262if (!matches) return false;263264var hour = matches[1];265var minute = matches[2];266var second = matches[3];267var timeZone = matches[5];268return ((hour <= 23 && minute <= 59 && second <= 59) ||269(hour == 23 && minute == 59 && second == 60)) &&270(!full || timeZone);271}272273274var DATE_TIME_SEPARATOR = /t|\s/i;275function date_time(str) {276// http://tools.ietf.org/html/rfc3339#section-5.6277var dateTime = str.split(DATE_TIME_SEPARATOR);278return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);279}280281282var NOT_URI_FRAGMENT = /\/|:/;283function uri(str) {284// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."285return NOT_URI_FRAGMENT.test(str) && URI.test(str);286}287288289var Z_ANCHOR = /[^\\]\\Z/;290function regex(str) {291if (Z_ANCHOR.test(str)) return false;292try {293new RegExp(str);294return true;295} catch(e) {296return false;297}298}299300},{"./util":10}],5:[function(require,module,exports){301'use strict';302303var resolve = require('./resolve')304, util = require('./util')305, errorClasses = require('./error_classes')306, stableStringify = require('fast-json-stable-stringify');307308var validateGenerator = require('../dotjs/validate');309310/**311* Functions below are used inside compiled validations function312*/313314var ucs2length = util.ucs2length;315var equal = require('fast-deep-equal');316317// this error is thrown by async schemas to return validation errors via exception318var ValidationError = errorClasses.Validation;319320module.exports = compile;321322323/**324* Compiles schema to validation function325* @this Ajv326* @param {Object} schema schema object327* @param {Object} root object with information about the root schema for this schema328* @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution329* @param {String} baseId base ID for IDs in the schema330* @return {Function} validation function331*/332function compile(schema, root, localRefs, baseId) {333/* jshint validthis: true, evil: true */334/* eslint no-shadow: 0 */335var self = this336, opts = this._opts337, refVal = [ undefined ]338, refs = {}339, patterns = []340, patternsHash = {}341, defaults = []342, defaultsHash = {}343, customRules = [];344345root = root || { schema: schema, refVal: refVal, refs: refs };346347var c = checkCompiling.call(this, schema, root, baseId);348var compilation = this._compilations[c.index];349if (c.compiling) return (compilation.callValidate = callValidate);350351var formats = this._formats;352var RULES = this.RULES;353354try {355var v = localCompile(schema, root, localRefs, baseId);356compilation.validate = v;357var cv = compilation.callValidate;358if (cv) {359cv.schema = v.schema;360cv.errors = null;361cv.refs = v.refs;362cv.refVal = v.refVal;363cv.root = v.root;364cv.$async = v.$async;365if (opts.sourceCode) cv.source = v.source;366}367return v;368} finally {369endCompiling.call(this, schema, root, baseId);370}371372/* @this {*} - custom context, see passContext option */373function callValidate() {374/* jshint validthis: true */375var validate = compilation.validate;376var result = validate.apply(this, arguments);377callValidate.errors = validate.errors;378return result;379}380381function localCompile(_schema, _root, localRefs, baseId) {382var isRoot = !_root || (_root && _root.schema == _schema);383if (_root.schema != root.schema)384return compile.call(self, _schema, _root, localRefs, baseId);385386var $async = _schema.$async === true;387388var sourceCode = validateGenerator({389isTop: true,390schema: _schema,391isRoot: isRoot,392baseId: baseId,393root: _root,394schemaPath: '',395errSchemaPath: '#',396errorPath: '""',397MissingRefError: errorClasses.MissingRef,398RULES: RULES,399validate: validateGenerator,400util: util,401resolve: resolve,402resolveRef: resolveRef,403usePattern: usePattern,404useDefault: useDefault,405useCustomRule: useCustomRule,406opts: opts,407formats: formats,408logger: self.logger,409self: self410});411412sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)413+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)414+ sourceCode;415416if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);417// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));418var validate;419try {420var makeValidate = new Function(421'self',422'RULES',423'formats',424'root',425'refVal',426'defaults',427'customRules',428'equal',429'ucs2length',430'ValidationError',431sourceCode432);433434validate = makeValidate(435self,436RULES,437formats,438root,439refVal,440defaults,441customRules,442equal,443ucs2length,444ValidationError445);446447refVal[0] = validate;448} catch(e) {449self.logger.error('Error compiling schema, function code:', sourceCode);450throw e;451}452453validate.schema = _schema;454validate.errors = null;455validate.refs = refs;456validate.refVal = refVal;457validate.root = isRoot ? validate : _root;458if ($async) validate.$async = true;459if (opts.sourceCode === true) {460validate.source = {461code: sourceCode,462patterns: patterns,463defaults: defaults464};465}466467return validate;468}469470function resolveRef(baseId, ref, isRoot) {471ref = resolve.url(baseId, ref);472var refIndex = refs[ref];473var _refVal, refCode;474if (refIndex !== undefined) {475_refVal = refVal[refIndex];476refCode = 'refVal[' + refIndex + ']';477return resolvedRef(_refVal, refCode);478}479if (!isRoot && root.refs) {480var rootRefId = root.refs[ref];481if (rootRefId !== undefined) {482_refVal = root.refVal[rootRefId];483refCode = addLocalRef(ref, _refVal);484return resolvedRef(_refVal, refCode);485}486}487488refCode = addLocalRef(ref);489var v = resolve.call(self, localCompile, root, ref);490if (v === undefined) {491var localSchema = localRefs && localRefs[ref];492if (localSchema) {493v = resolve.inlineRef(localSchema, opts.inlineRefs)494? localSchema495: compile.call(self, localSchema, root, localRefs, baseId);496}497}498499if (v === undefined) {500removeLocalRef(ref);501} else {502replaceLocalRef(ref, v);503return resolvedRef(v, refCode);504}505}506507function addLocalRef(ref, v) {508var refId = refVal.length;509refVal[refId] = v;510refs[ref] = refId;511return 'refVal' + refId;512}513514function removeLocalRef(ref) {515delete refs[ref];516}517518function replaceLocalRef(ref, v) {519var refId = refs[ref];520refVal[refId] = v;521}522523function resolvedRef(refVal, code) {524return typeof refVal == 'object' || typeof refVal == 'boolean'525? { code: code, schema: refVal, inline: true }526: { code: code, $async: refVal && !!refVal.$async };527}528529function usePattern(regexStr) {530var index = patternsHash[regexStr];531if (index === undefined) {532index = patternsHash[regexStr] = patterns.length;533patterns[index] = regexStr;534}535return 'pattern' + index;536}537538function useDefault(value) {539switch (typeof value) {540case 'boolean':541case 'number':542return '' + value;543case 'string':544return util.toQuotedString(value);545case 'object':546if (value === null) return 'null';547var valueStr = stableStringify(value);548var index = defaultsHash[valueStr];549if (index === undefined) {550index = defaultsHash[valueStr] = defaults.length;551defaults[index] = value;552}553return 'default' + index;554}555}556557function useCustomRule(rule, schema, parentSchema, it) {558if (self._opts.validateSchema !== false) {559var deps = rule.definition.dependencies;560if (deps && !deps.every(function(keyword) {561return Object.prototype.hasOwnProperty.call(parentSchema, keyword);562}))563throw new Error('parent schema must have all required keywords: ' + deps.join(','));564565var validateSchema = rule.definition.validateSchema;566if (validateSchema) {567var valid = validateSchema(schema);568if (!valid) {569var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);570if (self._opts.validateSchema == 'log') self.logger.error(message);571else throw new Error(message);572}573}574}575576var compile = rule.definition.compile577, inline = rule.definition.inline578, macro = rule.definition.macro;579580var validate;581if (compile) {582validate = compile.call(self, schema, parentSchema, it);583} else if (macro) {584validate = macro.call(self, schema, parentSchema, it);585if (opts.validateSchema !== false) self.validateSchema(validate, true);586} else if (inline) {587validate = inline.call(self, it, rule.keyword, schema, parentSchema);588} else {589validate = rule.definition.validate;590if (!validate) return;591}592593if (validate === undefined)594throw new Error('custom keyword "' + rule.keyword + '"failed to compile');595596var index = customRules.length;597customRules[index] = validate;598599return {600code: 'customRule' + index,601validate: validate602};603}604}605606607/**608* Checks if the schema is currently compiled609* @this Ajv610* @param {Object} schema schema to compile611* @param {Object} root root object612* @param {String} baseId base schema ID613* @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)614*/615function checkCompiling(schema, root, baseId) {616/* jshint validthis: true */617var index = compIndex.call(this, schema, root, baseId);618if (index >= 0) return { index: index, compiling: true };619index = this._compilations.length;620this._compilations[index] = {621schema: schema,622root: root,623baseId: baseId624};625return { index: index, compiling: false };626}627628629/**630* Removes the schema from the currently compiled list631* @this Ajv632* @param {Object} schema schema to compile633* @param {Object} root root object634* @param {String} baseId base schema ID635*/636function endCompiling(schema, root, baseId) {637/* jshint validthis: true */638var i = compIndex.call(this, schema, root, baseId);639if (i >= 0) this._compilations.splice(i, 1);640}641642643/**644* Index of schema compilation in the currently compiled list645* @this Ajv646* @param {Object} schema schema to compile647* @param {Object} root root object648* @param {String} baseId base schema ID649* @return {Integer} compilation index650*/651function compIndex(schema, root, baseId) {652/* jshint validthis: true */653for (var i=0; i<this._compilations.length; i++) {654var c = this._compilations[i];655if (c.schema == schema && c.root == root && c.baseId == baseId) return i;656}657return -1;658}659660661function patternCode(i, patterns) {662return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';663}664665666function defaultCode(i) {667return 'var default' + i + ' = defaults[' + i + '];';668}669670671function refValCode(i, refVal) {672return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';673}674675676function customRuleCode(i) {677return 'var customRule' + i + ' = customRules[' + i + '];';678}679680681function vars(arr, statement) {682if (!arr.length) return '';683var code = '';684for (var i=0; i<arr.length; i++)685code += statement(i, arr);686return code;687}688689},{"../dotjs/validate":38,"./error_classes":3,"./resolve":6,"./util":10,"fast-deep-equal":42,"fast-json-stable-stringify":43}],6:[function(require,module,exports){690'use strict';691692var URI = require('uri-js')693, equal = require('fast-deep-equal')694, util = require('./util')695, SchemaObject = require('./schema_obj')696, traverse = require('json-schema-traverse');697698module.exports = resolve;699700resolve.normalizeId = normalizeId;701resolve.fullPath = getFullPath;702resolve.url = resolveUrl;703resolve.ids = resolveIds;704resolve.inlineRef = inlineRef;705resolve.schema = resolveSchema;706707/**708* [resolve and compile the references ($ref)]709* @this Ajv710* @param {Function} compile reference to schema compilation funciton (localCompile)711* @param {Object} root object with information about the root schema for the current schema712* @param {String} ref reference to resolve713* @return {Object|Function} schema object (if the schema can be inlined) or validation function714*/715function resolve(compile, root, ref) {716/* jshint validthis: true */717var refVal = this._refs[ref];718if (typeof refVal == 'string') {719if (this._refs[refVal]) refVal = this._refs[refVal];720else return resolve.call(this, compile, root, refVal);721}722723refVal = refVal || this._schemas[ref];724if (refVal instanceof SchemaObject) {725return inlineRef(refVal.schema, this._opts.inlineRefs)726? refVal.schema727: refVal.validate || this._compile(refVal);728}729730var res = resolveSchema.call(this, root, ref);731var schema, v, baseId;732if (res) {733schema = res.schema;734root = res.root;735baseId = res.baseId;736}737738if (schema instanceof SchemaObject) {739v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);740} else if (schema !== undefined) {741v = inlineRef(schema, this._opts.inlineRefs)742? schema743: compile.call(this, schema, root, undefined, baseId);744}745746return v;747}748749750/**751* Resolve schema, its root and baseId752* @this Ajv753* @param {Object} root root object with properties schema, refVal, refs754* @param {String} ref reference to resolve755* @return {Object} object with properties schema, root, baseId756*/757function resolveSchema(root, ref) {758/* jshint validthis: true */759var p = URI.parse(ref)760, refPath = _getFullPath(p)761, baseId = getFullPath(this._getId(root.schema));762if (Object.keys(root.schema).length === 0 || refPath !== baseId) {763var id = normalizeId(refPath);764var refVal = this._refs[id];765if (typeof refVal == 'string') {766return resolveRecursive.call(this, root, refVal, p);767} else if (refVal instanceof SchemaObject) {768if (!refVal.validate) this._compile(refVal);769root = refVal;770} else {771refVal = this._schemas[id];772if (refVal instanceof SchemaObject) {773if (!refVal.validate) this._compile(refVal);774if (id == normalizeId(ref))775return { schema: refVal, root: root, baseId: baseId };776root = refVal;777} else {778return;779}780}781if (!root.schema) return;782baseId = getFullPath(this._getId(root.schema));783}784return getJsonPointer.call(this, p, baseId, root.schema, root);785}786787788/* @this Ajv */789function resolveRecursive(root, ref, parsedRef) {790/* jshint validthis: true */791var res = resolveSchema.call(this, root, ref);792if (res) {793var schema = res.schema;794var baseId = res.baseId;795root = res.root;796var id = this._getId(schema);797if (id) baseId = resolveUrl(baseId, id);798return getJsonPointer.call(this, parsedRef, baseId, schema, root);799}800}801802803var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);804/* @this Ajv */805function getJsonPointer(parsedRef, baseId, schema, root) {806/* jshint validthis: true */807parsedRef.fragment = parsedRef.fragment || '';808if (parsedRef.fragment.slice(0,1) != '/') return;809var parts = parsedRef.fragment.split('/');810811for (var i = 1; i < parts.length; i++) {812var part = parts[i];813if (part) {814part = util.unescapeFragment(part);815schema = schema[part];816if (schema === undefined) break;817var id;818if (!PREVENT_SCOPE_CHANGE[part]) {819id = this._getId(schema);820if (id) baseId = resolveUrl(baseId, id);821if (schema.$ref) {822var $ref = resolveUrl(baseId, schema.$ref);823var res = resolveSchema.call(this, root, $ref);824if (res) {825schema = res.schema;826root = res.root;827baseId = res.baseId;828}829}830}831}832}833if (schema !== undefined && schema !== root.schema)834return { schema: schema, root: root, baseId: baseId };835}836837838var SIMPLE_INLINED = util.toHash([839'type', 'format', 'pattern',840'maxLength', 'minLength',841'maxProperties', 'minProperties',842'maxItems', 'minItems',843'maximum', 'minimum',844'uniqueItems', 'multipleOf',845'required', 'enum'846]);847function inlineRef(schema, limit) {848if (limit === false) return false;849if (limit === undefined || limit === true) return checkNoRef(schema);850else if (limit) return countKeys(schema) <= limit;851}852853854function checkNoRef(schema) {855var item;856if (Array.isArray(schema)) {857for (var i=0; i<schema.length; i++) {858item = schema[i];859if (typeof item == 'object' && !checkNoRef(item)) return false;860}861} else {862for (var key in schema) {863if (key == '$ref') return false;864item = schema[key];865if (typeof item == 'object' && !checkNoRef(item)) return false;866}867}868return true;869}870871872function countKeys(schema) {873var count = 0, item;874if (Array.isArray(schema)) {875for (var i=0; i<schema.length; i++) {876item = schema[i];877if (typeof item == 'object') count += countKeys(item);878if (count == Infinity) return Infinity;879}880} else {881for (var key in schema) {882if (key == '$ref') return Infinity;883if (SIMPLE_INLINED[key]) {884count++;885} else {886item = schema[key];887if (typeof item == 'object') count += countKeys(item) + 1;888if (count == Infinity) return Infinity;889}890}891}892return count;893}894895896function getFullPath(id, normalize) {897if (normalize !== false) id = normalizeId(id);898var p = URI.parse(id);899return _getFullPath(p);900}901902903function _getFullPath(p) {904return URI.serialize(p).split('#')[0] + '#';905}906907908var TRAILING_SLASH_HASH = /#\/?$/;909function normalizeId(id) {910return id ? id.replace(TRAILING_SLASH_HASH, '') : '';911}912913914function resolveUrl(baseId, id) {915id = normalizeId(id);916return URI.resolve(baseId, id);917}918919920/* @this Ajv */921function resolveIds(schema) {922var schemaId = normalizeId(this._getId(schema));923var baseIds = {'': schemaId};924var fullPaths = {'': getFullPath(schemaId, false)};925var localRefs = {};926var self = this;927928traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {929if (jsonPtr === '') return;930var id = self._getId(sch);931var baseId = baseIds[parentJsonPtr];932var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;933if (keyIndex !== undefined)934fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));935936if (typeof id == 'string') {937id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);938939var refVal = self._refs[id];940if (typeof refVal == 'string') refVal = self._refs[refVal];941if (refVal && refVal.schema) {942if (!equal(sch, refVal.schema))943throw new Error('id "' + id + '" resolves to more than one schema');944} else if (id != normalizeId(fullPath)) {945if (id[0] == '#') {946if (localRefs[id] && !equal(sch, localRefs[id]))947throw new Error('id "' + id + '" resolves to more than one schema');948localRefs[id] = sch;949} else {950self._refs[id] = fullPath;951}952}953}954baseIds[jsonPtr] = baseId;955fullPaths[jsonPtr] = fullPath;956});957958return localRefs;959}960961},{"./schema_obj":8,"./util":10,"fast-deep-equal":42,"json-schema-traverse":44,"uri-js":45}],7:[function(require,module,exports){962'use strict';963964var ruleModules = require('../dotjs')965, toHash = require('./util').toHash;966967module.exports = function rules() {968var RULES = [969{ type: 'number',970rules: [ { 'maximum': ['exclusiveMaximum'] },971{ 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },972{ type: 'string',973rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },974{ type: 'array',975rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },976{ type: 'object',977rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',978{ 'properties': ['additionalProperties', 'patternProperties'] } ] },979{ rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }980];981982var ALL = [ 'type', '$comment' ];983var KEYWORDS = [984'$schema', '$id', 'id', '$data', '$async', 'title',985'description', 'default', 'definitions',986'examples', 'readOnly', 'writeOnly',987'contentMediaType', 'contentEncoding',988'additionalItems', 'then', 'else'989];990var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];991RULES.all = toHash(ALL);992RULES.types = toHash(TYPES);993994RULES.forEach(function (group) {995group.rules = group.rules.map(function (keyword) {996var implKeywords;997if (typeof keyword == 'object') {998var key = Object.keys(keyword)[0];999implKeywords = keyword[key];1000keyword = key;1001implKeywords.forEach(function (k) {1002ALL.push(k);1003RULES.all[k] = true;1004});1005}1006ALL.push(keyword);1007var rule = RULES.all[keyword] = {1008keyword: keyword,1009code: ruleModules[keyword],1010implements: implKeywords1011};1012return rule;1013});10141015RULES.all.$comment = {1016keyword: '$comment',1017code: ruleModules.$comment1018};10191020if (group.type) RULES.types[group.type] = group;1021});10221023RULES.keywords = toHash(ALL.concat(KEYWORDS));1024RULES.custom = {};10251026return RULES;1027};10281029},{"../dotjs":27,"./util":10}],8:[function(require,module,exports){1030'use strict';10311032var util = require('./util');10331034module.exports = SchemaObject;10351036function SchemaObject(obj) {1037util.copy(obj, this);1038}10391040},{"./util":10}],9:[function(require,module,exports){1041'use strict';10421043// https://mathiasbynens.be/notes/javascript-encoding1044// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode1045module.exports = function ucs2length(str) {1046var length = 01047, len = str.length1048, pos = 01049, value;1050while (pos < len) {1051length++;1052value = str.charCodeAt(pos++);1053if (value >= 0xD800 && value <= 0xDBFF && pos < len) {1054// high surrogate, and there is a next character1055value = str.charCodeAt(pos);1056if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate1057}1058}1059return length;1060};10611062},{}],10:[function(require,module,exports){1063'use strict';106410651066module.exports = {1067copy: copy,1068checkDataType: checkDataType,1069checkDataTypes: checkDataTypes,1070coerceToTypes: coerceToTypes,1071toHash: toHash,1072getProperty: getProperty,1073escapeQuotes: escapeQuotes,1074equal: require('fast-deep-equal'),1075ucs2length: require('./ucs2length'),1076varOccurences: varOccurences,1077varReplace: varReplace,1078schemaHasRules: schemaHasRules,1079schemaHasRulesExcept: schemaHasRulesExcept,1080schemaUnknownRules: schemaUnknownRules,1081toQuotedString: toQuotedString,1082getPathExpr: getPathExpr,1083getPath: getPath,1084getData: getData,1085unescapeFragment: unescapeFragment,1086unescapeJsonPointer: unescapeJsonPointer,1087escapeFragment: escapeFragment,1088escapeJsonPointer: escapeJsonPointer1089};109010911092function copy(o, to) {1093to = to || {};1094for (var key in o) to[key] = o[key];1095return to;1096}109710981099function checkDataType(dataType, data, strictNumbers, negate) {1100var EQUAL = negate ? ' !== ' : ' === '1101, AND = negate ? ' || ' : ' && '1102, OK = negate ? '!' : ''1103, NOT = negate ? '' : '!';1104switch (dataType) {1105case 'null': return data + EQUAL + 'null';1106case 'array': return OK + 'Array.isArray(' + data + ')';1107case 'object': return '(' + OK + data + AND +1108'typeof ' + data + EQUAL + '"object"' + AND +1109NOT + 'Array.isArray(' + data + '))';1110case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +1111NOT + '(' + data + ' % 1)' +1112AND + data + EQUAL + data +1113(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';1114case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +1115(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';1116default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';1117}1118}111911201121function checkDataTypes(dataTypes, data, strictNumbers) {1122switch (dataTypes.length) {1123case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);1124default:1125var code = '';1126var types = toHash(dataTypes);1127if (types.array && types.object) {1128code = types.null ? '(': '(!' + data + ' || ';1129code += 'typeof ' + data + ' !== "object")';1130delete types.null;1131delete types.array;1132delete types.object;1133}1134if (types.number) delete types.integer;1135for (var t in types)1136code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);11371138return code;1139}1140}114111421143var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);1144function coerceToTypes(optionCoerceTypes, dataTypes) {1145if (Array.isArray(dataTypes)) {1146var types = [];1147for (var i=0; i<dataTypes.length; i++) {1148var t = dataTypes[i];1149if (COERCE_TO_TYPES[t]) types[types.length] = t;1150else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;1151}1152if (types.length) return types;1153} else if (COERCE_TO_TYPES[dataTypes]) {1154return [dataTypes];1155} else if (optionCoerceTypes === 'array' && dataTypes === 'array') {1156return ['array'];1157}1158}115911601161function toHash(arr) {1162var hash = {};1163for (var i=0; i<arr.length; i++) hash[arr[i]] = true;1164return hash;1165}116611671168var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;1169var SINGLE_QUOTE = /'|\\/g;1170function getProperty(key) {1171return typeof key == 'number'1172? '[' + key + ']'1173: IDENTIFIER.test(key)1174? '.' + key1175: "['" + escapeQuotes(key) + "']";1176}117711781179function escapeQuotes(str) {1180return str.replace(SINGLE_QUOTE, '\\$&')1181.replace(/\n/g, '\\n')1182.replace(/\r/g, '\\r')1183.replace(/\f/g, '\\f')1184.replace(/\t/g, '\\t');1185}118611871188function varOccurences(str, dataVar) {1189dataVar += '[^0-9]';1190var matches = str.match(new RegExp(dataVar, 'g'));1191return matches ? matches.length : 0;1192}119311941195function varReplace(str, dataVar, expr) {1196dataVar += '([^0-9])';1197expr = expr.replace(/\$/g, '$$$$');1198return str.replace(new RegExp(dataVar, 'g'), expr + '$1');1199}120012011202function schemaHasRules(schema, rules) {1203if (typeof schema == 'boolean') return !schema;1204for (var key in schema) if (rules[key]) return true;1205}120612071208function schemaHasRulesExcept(schema, rules, exceptKeyword) {1209if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';1210for (var key in schema) if (key != exceptKeyword && rules[key]) return true;1211}121212131214function schemaUnknownRules(schema, rules) {1215if (typeof schema == 'boolean') return;1216for (var key in schema) if (!rules[key]) return key;1217}121812191220function toQuotedString(str) {1221return '\'' + escapeQuotes(str) + '\'';1222}122312241225function getPathExpr(currentPath, expr, jsonPointers, isNumber) {1226var path = jsonPointers // false by default1227? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')1228: (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');1229return joinPaths(currentPath, path);1230}123112321233function getPath(currentPath, prop, jsonPointers) {1234var path = jsonPointers // false by default1235? toQuotedString('/' + escapeJsonPointer(prop))1236: toQuotedString(getProperty(prop));1237return joinPaths(currentPath, path);1238}123912401241var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;1242var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;1243function getData($data, lvl, paths) {1244var up, jsonPointer, data, matches;1245if ($data === '') return 'rootData';1246if ($data[0] == '/') {1247if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);1248jsonPointer = $data;1249data = 'rootData';1250} else {1251matches = $data.match(RELATIVE_JSON_POINTER);1252if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);1253up = +matches[1];1254jsonPointer = matches[2];1255if (jsonPointer == '#') {1256if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);1257return paths[lvl - up];1258}12591260if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);1261data = 'data' + ((lvl - up) || '');1262if (!jsonPointer) return data;1263}12641265var expr = data;1266var segments = jsonPointer.split('/');1267for (var i=0; i<segments.length; i++) {1268var segment = segments[i];1269if (segment) {1270data += getProperty(unescapeJsonPointer(segment));1271expr += ' && ' + data;1272}1273}1274return expr;1275}127612771278function joinPaths (a, b) {1279if (a == '""') return b;1280return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');1281}128212831284function unescapeFragment(str) {1285return unescapeJsonPointer(decodeURIComponent(str));1286}128712881289function escapeFragment(str) {1290return encodeURIComponent(escapeJsonPointer(str));1291}129212931294function escapeJsonPointer(str) {1295return str.replace(/~/g, '~0').replace(/\//g, '~1');1296}129712981299function unescapeJsonPointer(str) {1300return str.replace(/~1/g, '/').replace(/~0/g, '~');1301}13021303},{"./ucs2length":9,"fast-deep-equal":42}],11:[function(require,module,exports){1304'use strict';13051306var KEYWORDS = [1307'multipleOf',1308'maximum',1309'exclusiveMaximum',1310'minimum',1311'exclusiveMinimum',1312'maxLength',1313'minLength',1314'pattern',1315'additionalItems',1316'maxItems',1317'minItems',1318'uniqueItems',1319'maxProperties',1320'minProperties',1321'required',1322'additionalProperties',1323'enum',1324'format',1325'const'1326];13271328module.exports = function (metaSchema, keywordsJsonPointers) {1329for (var i=0; i<keywordsJsonPointers.length; i++) {1330metaSchema = JSON.parse(JSON.stringify(metaSchema));1331var segments = keywordsJsonPointers[i].split('/');1332var keywords = metaSchema;1333var j;1334for (j=1; j<segments.length; j++)1335keywords = keywords[segments[j]];13361337for (j=0; j<KEYWORDS.length; j++) {1338var key = KEYWORDS[j];1339var schema = keywords[key];1340if (schema) {1341keywords[key] = {1342anyOf: [1343schema,1344{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }1345]1346};1347}1348}1349}13501351return metaSchema;1352};13531354},{}],12:[function(require,module,exports){1355'use strict';13561357var metaSchema = require('./refs/json-schema-draft-07.json');13581359module.exports = {1360$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',1361definitions: {1362simpleTypes: metaSchema.definitions.simpleTypes1363},1364type: 'object',1365dependencies: {1366schema: ['validate'],1367$data: ['validate'],1368statements: ['inline'],1369valid: {not: {required: ['macro']}}1370},1371properties: {1372type: metaSchema.properties.type,1373schema: {type: 'boolean'},1374statements: {type: 'boolean'},1375dependencies: {1376type: 'array',1377items: {type: 'string'}1378},1379metaSchema: {type: 'object'},1380modifying: {type: 'boolean'},1381valid: {type: 'boolean'},1382$data: {type: 'boolean'},1383async: {type: 'boolean'},1384errors: {1385anyOf: [1386{type: 'boolean'},1387{const: 'full'}1388]1389}1390}1391};13921393},{"./refs/json-schema-draft-07.json":41}],13:[function(require,module,exports){1394'use strict';1395module.exports = function generate__limit(it, $keyword, $ruleType) {1396var out = ' ';1397var $lvl = it.level;1398var $dataLvl = it.dataLevel;1399var $schema = it.schema[$keyword];1400var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1401var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1402var $breakOnError = !it.opts.allErrors;1403var $errorKeyword;1404var $data = 'data' + ($dataLvl || '');1405var $isData = it.opts.$data && $schema && $schema.$data,1406$schemaValue;1407if ($isData) {1408out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';1409$schemaValue = 'schema' + $lvl;1410} else {1411$schemaValue = $schema;1412}1413var $isMax = $keyword == 'maximum',1414$exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',1415$schemaExcl = it.schema[$exclusiveKeyword],1416$isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,1417$op = $isMax ? '<' : '>',1418$notOp = $isMax ? '>' : '<',1419$errorKeyword = undefined;1420if (!($isData || typeof $schema == 'number' || $schema === undefined)) {1421throw new Error($keyword + ' must be number');1422}1423if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {1424throw new Error($exclusiveKeyword + ' must be number or boolean');1425}1426if ($isDataExcl) {1427var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),1428$exclusive = 'exclusive' + $lvl,1429$exclType = 'exclType' + $lvl,1430$exclIsNumber = 'exclIsNumber' + $lvl,1431$opExpr = 'op' + $lvl,1432$opStr = '\' + ' + $opExpr + ' + \'';1433out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';1434$schemaValueExcl = 'schemaExcl' + $lvl;1435out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { ';1436var $errorKeyword = $exclusiveKeyword;1437var $$outStack = $$outStack || [];1438$$outStack.push(out);1439out = ''; /* istanbul ignore else */1440if (it.createErrors !== false) {1441out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';1442if (it.opts.messages !== false) {1443out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';1444}1445if (it.opts.verbose) {1446out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1447}1448out += ' } ';1449} else {1450out += ' {} ';1451}1452var __err = out;1453out = $$outStack.pop();1454if (!it.compositeRule && $breakOnError) {1455/* istanbul ignore if */1456if (it.async) {1457out += ' throw new ValidationError([' + (__err) + ']); ';1458} else {1459out += ' validate.errors = [' + (__err) + ']; return false; ';1460}1461} else {1462out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1463}1464out += ' } else if ( ';1465if ($isData) {1466out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';1467}1468out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; ';1469if ($schema === undefined) {1470$errorKeyword = $exclusiveKeyword;1471$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;1472$schemaValue = $schemaValueExcl;1473$isData = $isDataExcl;1474}1475} else {1476var $exclIsNumber = typeof $schemaExcl == 'number',1477$opStr = $op;1478if ($exclIsNumber && $isData) {1479var $opExpr = '\'' + $opStr + '\'';1480out += ' if ( ';1481if ($isData) {1482out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';1483}1484out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';1485} else {1486if ($exclIsNumber && $schema === undefined) {1487$exclusive = true;1488$errorKeyword = $exclusiveKeyword;1489$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;1490$schemaValue = $schemaExcl;1491$notOp += '=';1492} else {1493if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);1494if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {1495$exclusive = true;1496$errorKeyword = $exclusiveKeyword;1497$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;1498$notOp += '=';1499} else {1500$exclusive = false;1501$opStr += '=';1502}1503}1504var $opExpr = '\'' + $opStr + '\'';1505out += ' if ( ';1506if ($isData) {1507out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';1508}1509out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';1510}1511}1512$errorKeyword = $errorKeyword || $keyword;1513var $$outStack = $$outStack || [];1514$$outStack.push(out);1515out = ''; /* istanbul ignore else */1516if (it.createErrors !== false) {1517out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';1518if (it.opts.messages !== false) {1519out += ' , message: \'should be ' + ($opStr) + ' ';1520if ($isData) {1521out += '\' + ' + ($schemaValue);1522} else {1523out += '' + ($schemaValue) + '\'';1524}1525}1526if (it.opts.verbose) {1527out += ' , schema: ';1528if ($isData) {1529out += 'validate.schema' + ($schemaPath);1530} else {1531out += '' + ($schema);1532}1533out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1534}1535out += ' } ';1536} else {1537out += ' {} ';1538}1539var __err = out;1540out = $$outStack.pop();1541if (!it.compositeRule && $breakOnError) {1542/* istanbul ignore if */1543if (it.async) {1544out += ' throw new ValidationError([' + (__err) + ']); ';1545} else {1546out += ' validate.errors = [' + (__err) + ']; return false; ';1547}1548} else {1549out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1550}1551out += ' } ';1552if ($breakOnError) {1553out += ' else { ';1554}1555return out;1556}15571558},{}],14:[function(require,module,exports){1559'use strict';1560module.exports = function generate__limitItems(it, $keyword, $ruleType) {1561var out = ' ';1562var $lvl = it.level;1563var $dataLvl = it.dataLevel;1564var $schema = it.schema[$keyword];1565var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1566var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1567var $breakOnError = !it.opts.allErrors;1568var $errorKeyword;1569var $data = 'data' + ($dataLvl || '');1570var $isData = it.opts.$data && $schema && $schema.$data,1571$schemaValue;1572if ($isData) {1573out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';1574$schemaValue = 'schema' + $lvl;1575} else {1576$schemaValue = $schema;1577}1578if (!($isData || typeof $schema == 'number')) {1579throw new Error($keyword + ' must be number');1580}1581var $op = $keyword == 'maxItems' ? '>' : '<';1582out += 'if ( ';1583if ($isData) {1584out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';1585}1586out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';1587var $errorKeyword = $keyword;1588var $$outStack = $$outStack || [];1589$$outStack.push(out);1590out = ''; /* istanbul ignore else */1591if (it.createErrors !== false) {1592out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';1593if (it.opts.messages !== false) {1594out += ' , message: \'should NOT have ';1595if ($keyword == 'maxItems') {1596out += 'more';1597} else {1598out += 'fewer';1599}1600out += ' than ';1601if ($isData) {1602out += '\' + ' + ($schemaValue) + ' + \'';1603} else {1604out += '' + ($schema);1605}1606out += ' items\' ';1607}1608if (it.opts.verbose) {1609out += ' , schema: ';1610if ($isData) {1611out += 'validate.schema' + ($schemaPath);1612} else {1613out += '' + ($schema);1614}1615out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1616}1617out += ' } ';1618} else {1619out += ' {} ';1620}1621var __err = out;1622out = $$outStack.pop();1623if (!it.compositeRule && $breakOnError) {1624/* istanbul ignore if */1625if (it.async) {1626out += ' throw new ValidationError([' + (__err) + ']); ';1627} else {1628out += ' validate.errors = [' + (__err) + ']; return false; ';1629}1630} else {1631out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1632}1633out += '} ';1634if ($breakOnError) {1635out += ' else { ';1636}1637return out;1638}16391640},{}],15:[function(require,module,exports){1641'use strict';1642module.exports = function generate__limitLength(it, $keyword, $ruleType) {1643var out = ' ';1644var $lvl = it.level;1645var $dataLvl = it.dataLevel;1646var $schema = it.schema[$keyword];1647var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1648var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1649var $breakOnError = !it.opts.allErrors;1650var $errorKeyword;1651var $data = 'data' + ($dataLvl || '');1652var $isData = it.opts.$data && $schema && $schema.$data,1653$schemaValue;1654if ($isData) {1655out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';1656$schemaValue = 'schema' + $lvl;1657} else {1658$schemaValue = $schema;1659}1660if (!($isData || typeof $schema == 'number')) {1661throw new Error($keyword + ' must be number');1662}1663var $op = $keyword == 'maxLength' ? '>' : '<';1664out += 'if ( ';1665if ($isData) {1666out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';1667}1668if (it.opts.unicode === false) {1669out += ' ' + ($data) + '.length ';1670} else {1671out += ' ucs2length(' + ($data) + ') ';1672}1673out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';1674var $errorKeyword = $keyword;1675var $$outStack = $$outStack || [];1676$$outStack.push(out);1677out = ''; /* istanbul ignore else */1678if (it.createErrors !== false) {1679out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';1680if (it.opts.messages !== false) {1681out += ' , message: \'should NOT be ';1682if ($keyword == 'maxLength') {1683out += 'longer';1684} else {1685out += 'shorter';1686}1687out += ' than ';1688if ($isData) {1689out += '\' + ' + ($schemaValue) + ' + \'';1690} else {1691out += '' + ($schema);1692}1693out += ' characters\' ';1694}1695if (it.opts.verbose) {1696out += ' , schema: ';1697if ($isData) {1698out += 'validate.schema' + ($schemaPath);1699} else {1700out += '' + ($schema);1701}1702out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1703}1704out += ' } ';1705} else {1706out += ' {} ';1707}1708var __err = out;1709out = $$outStack.pop();1710if (!it.compositeRule && $breakOnError) {1711/* istanbul ignore if */1712if (it.async) {1713out += ' throw new ValidationError([' + (__err) + ']); ';1714} else {1715out += ' validate.errors = [' + (__err) + ']; return false; ';1716}1717} else {1718out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1719}1720out += '} ';1721if ($breakOnError) {1722out += ' else { ';1723}1724return out;1725}17261727},{}],16:[function(require,module,exports){1728'use strict';1729module.exports = function generate__limitProperties(it, $keyword, $ruleType) {1730var out = ' ';1731var $lvl = it.level;1732var $dataLvl = it.dataLevel;1733var $schema = it.schema[$keyword];1734var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1735var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1736var $breakOnError = !it.opts.allErrors;1737var $errorKeyword;1738var $data = 'data' + ($dataLvl || '');1739var $isData = it.opts.$data && $schema && $schema.$data,1740$schemaValue;1741if ($isData) {1742out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';1743$schemaValue = 'schema' + $lvl;1744} else {1745$schemaValue = $schema;1746}1747if (!($isData || typeof $schema == 'number')) {1748throw new Error($keyword + ' must be number');1749}1750var $op = $keyword == 'maxProperties' ? '>' : '<';1751out += 'if ( ';1752if ($isData) {1753out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';1754}1755out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';1756var $errorKeyword = $keyword;1757var $$outStack = $$outStack || [];1758$$outStack.push(out);1759out = ''; /* istanbul ignore else */1760if (it.createErrors !== false) {1761out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';1762if (it.opts.messages !== false) {1763out += ' , message: \'should NOT have ';1764if ($keyword == 'maxProperties') {1765out += 'more';1766} else {1767out += 'fewer';1768}1769out += ' than ';1770if ($isData) {1771out += '\' + ' + ($schemaValue) + ' + \'';1772} else {1773out += '' + ($schema);1774}1775out += ' properties\' ';1776}1777if (it.opts.verbose) {1778out += ' , schema: ';1779if ($isData) {1780out += 'validate.schema' + ($schemaPath);1781} else {1782out += '' + ($schema);1783}1784out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1785}1786out += ' } ';1787} else {1788out += ' {} ';1789}1790var __err = out;1791out = $$outStack.pop();1792if (!it.compositeRule && $breakOnError) {1793/* istanbul ignore if */1794if (it.async) {1795out += ' throw new ValidationError([' + (__err) + ']); ';1796} else {1797out += ' validate.errors = [' + (__err) + ']; return false; ';1798}1799} else {1800out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1801}1802out += '} ';1803if ($breakOnError) {1804out += ' else { ';1805}1806return out;1807}18081809},{}],17:[function(require,module,exports){1810'use strict';1811module.exports = function generate_allOf(it, $keyword, $ruleType) {1812var out = ' ';1813var $schema = it.schema[$keyword];1814var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1815var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1816var $breakOnError = !it.opts.allErrors;1817var $it = it.util.copy(it);1818var $closingBraces = '';1819$it.level++;1820var $nextValid = 'valid' + $it.level;1821var $currentBaseId = $it.baseId,1822$allSchemasEmpty = true;1823var arr1 = $schema;1824if (arr1) {1825var $sch, $i = -1,1826l1 = arr1.length - 1;1827while ($i < l1) {1828$sch = arr1[$i += 1];1829if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {1830$allSchemasEmpty = false;1831$it.schema = $sch;1832$it.schemaPath = $schemaPath + '[' + $i + ']';1833$it.errSchemaPath = $errSchemaPath + '/' + $i;1834out += ' ' + (it.validate($it)) + ' ';1835$it.baseId = $currentBaseId;1836if ($breakOnError) {1837out += ' if (' + ($nextValid) + ') { ';1838$closingBraces += '}';1839}1840}1841}1842}1843if ($breakOnError) {1844if ($allSchemasEmpty) {1845out += ' if (true) { ';1846} else {1847out += ' ' + ($closingBraces.slice(0, -1)) + ' ';1848}1849}1850return out;1851}18521853},{}],18:[function(require,module,exports){1854'use strict';1855module.exports = function generate_anyOf(it, $keyword, $ruleType) {1856var out = ' ';1857var $lvl = it.level;1858var $dataLvl = it.dataLevel;1859var $schema = it.schema[$keyword];1860var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1861var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1862var $breakOnError = !it.opts.allErrors;1863var $data = 'data' + ($dataLvl || '');1864var $valid = 'valid' + $lvl;1865var $errs = 'errs__' + $lvl;1866var $it = it.util.copy(it);1867var $closingBraces = '';1868$it.level++;1869var $nextValid = 'valid' + $it.level;1870var $noEmptySchema = $schema.every(function($sch) {1871return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));1872});1873if ($noEmptySchema) {1874var $currentBaseId = $it.baseId;1875out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';1876var $wasComposite = it.compositeRule;1877it.compositeRule = $it.compositeRule = true;1878var arr1 = $schema;1879if (arr1) {1880var $sch, $i = -1,1881l1 = arr1.length - 1;1882while ($i < l1) {1883$sch = arr1[$i += 1];1884$it.schema = $sch;1885$it.schemaPath = $schemaPath + '[' + $i + ']';1886$it.errSchemaPath = $errSchemaPath + '/' + $i;1887out += ' ' + (it.validate($it)) + ' ';1888$it.baseId = $currentBaseId;1889out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';1890$closingBraces += '}';1891}1892}1893it.compositeRule = $it.compositeRule = $wasComposite;1894out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */1895if (it.createErrors !== false) {1896out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';1897if (it.opts.messages !== false) {1898out += ' , message: \'should match some schema in anyOf\' ';1899}1900if (it.opts.verbose) {1901out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1902}1903out += ' } ';1904} else {1905out += ' {} ';1906}1907out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1908if (!it.compositeRule && $breakOnError) {1909/* istanbul ignore if */1910if (it.async) {1911out += ' throw new ValidationError(vErrors); ';1912} else {1913out += ' validate.errors = vErrors; return false; ';1914}1915}1916out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';1917if (it.opts.allErrors) {1918out += ' } ';1919}1920} else {1921if ($breakOnError) {1922out += ' if (true) { ';1923}1924}1925return out;1926}19271928},{}],19:[function(require,module,exports){1929'use strict';1930module.exports = function generate_comment(it, $keyword, $ruleType) {1931var out = ' ';1932var $schema = it.schema[$keyword];1933var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1934var $breakOnError = !it.opts.allErrors;1935var $comment = it.util.toQuotedString($schema);1936if (it.opts.$comment === true) {1937out += ' console.log(' + ($comment) + ');';1938} else if (typeof it.opts.$comment == 'function') {1939out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';1940}1941return out;1942}19431944},{}],20:[function(require,module,exports){1945'use strict';1946module.exports = function generate_const(it, $keyword, $ruleType) {1947var out = ' ';1948var $lvl = it.level;1949var $dataLvl = it.dataLevel;1950var $schema = it.schema[$keyword];1951var $schemaPath = it.schemaPath + it.util.getProperty($keyword);1952var $errSchemaPath = it.errSchemaPath + '/' + $keyword;1953var $breakOnError = !it.opts.allErrors;1954var $data = 'data' + ($dataLvl || '');1955var $valid = 'valid' + $lvl;1956var $isData = it.opts.$data && $schema && $schema.$data,1957$schemaValue;1958if ($isData) {1959out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';1960$schemaValue = 'schema' + $lvl;1961} else {1962$schemaValue = $schema;1963}1964if (!$isData) {1965out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';1966}1967out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';1968var $$outStack = $$outStack || [];1969$$outStack.push(out);1970out = ''; /* istanbul ignore else */1971if (it.createErrors !== false) {1972out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';1973if (it.opts.messages !== false) {1974out += ' , message: \'should be equal to constant\' ';1975}1976if (it.opts.verbose) {1977out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';1978}1979out += ' } ';1980} else {1981out += ' {} ';1982}1983var __err = out;1984out = $$outStack.pop();1985if (!it.compositeRule && $breakOnError) {1986/* istanbul ignore if */1987if (it.async) {1988out += ' throw new ValidationError([' + (__err) + ']); ';1989} else {1990out += ' validate.errors = [' + (__err) + ']; return false; ';1991}1992} else {1993out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';1994}1995out += ' }';1996if ($breakOnError) {1997out += ' else { ';1998}1999return out;2000}20012002},{}],21:[function(require,module,exports){2003'use strict';2004module.exports = function generate_contains(it, $keyword, $ruleType) {2005var out = ' ';2006var $lvl = it.level;2007var $dataLvl = it.dataLevel;2008var $schema = it.schema[$keyword];2009var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2010var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2011var $breakOnError = !it.opts.allErrors;2012var $data = 'data' + ($dataLvl || '');2013var $valid = 'valid' + $lvl;2014var $errs = 'errs__' + $lvl;2015var $it = it.util.copy(it);2016var $closingBraces = '';2017$it.level++;2018var $nextValid = 'valid' + $it.level;2019var $idx = 'i' + $lvl,2020$dataNxt = $it.dataLevel = it.dataLevel + 1,2021$nextData = 'data' + $dataNxt,2022$currentBaseId = it.baseId,2023$nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));2024out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';2025if ($nonEmptySchema) {2026var $wasComposite = it.compositeRule;2027it.compositeRule = $it.compositeRule = true;2028$it.schema = $schema;2029$it.schemaPath = $schemaPath;2030$it.errSchemaPath = $errSchemaPath;2031out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';2032$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);2033var $passData = $data + '[' + $idx + ']';2034$it.dataPathArr[$dataNxt] = $idx;2035var $code = it.validate($it);2036$it.baseId = $currentBaseId;2037if (it.util.varOccurences($code, $nextData) < 2) {2038out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';2039} else {2040out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';2041}2042out += ' if (' + ($nextValid) + ') break; } ';2043it.compositeRule = $it.compositeRule = $wasComposite;2044out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {';2045} else {2046out += ' if (' + ($data) + '.length == 0) {';2047}2048var $$outStack = $$outStack || [];2049$$outStack.push(out);2050out = ''; /* istanbul ignore else */2051if (it.createErrors !== false) {2052out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';2053if (it.opts.messages !== false) {2054out += ' , message: \'should contain a valid item\' ';2055}2056if (it.opts.verbose) {2057out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2058}2059out += ' } ';2060} else {2061out += ' {} ';2062}2063var __err = out;2064out = $$outStack.pop();2065if (!it.compositeRule && $breakOnError) {2066/* istanbul ignore if */2067if (it.async) {2068out += ' throw new ValidationError([' + (__err) + ']); ';2069} else {2070out += ' validate.errors = [' + (__err) + ']; return false; ';2071}2072} else {2073out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2074}2075out += ' } else { ';2076if ($nonEmptySchema) {2077out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';2078}2079if (it.opts.allErrors) {2080out += ' } ';2081}2082return out;2083}20842085},{}],22:[function(require,module,exports){2086'use strict';2087module.exports = function generate_custom(it, $keyword, $ruleType) {2088var out = ' ';2089var $lvl = it.level;2090var $dataLvl = it.dataLevel;2091var $schema = it.schema[$keyword];2092var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2093var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2094var $breakOnError = !it.opts.allErrors;2095var $errorKeyword;2096var $data = 'data' + ($dataLvl || '');2097var $valid = 'valid' + $lvl;2098var $errs = 'errs__' + $lvl;2099var $isData = it.opts.$data && $schema && $schema.$data,2100$schemaValue;2101if ($isData) {2102out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';2103$schemaValue = 'schema' + $lvl;2104} else {2105$schemaValue = $schema;2106}2107var $rule = this,2108$definition = 'definition' + $lvl,2109$rDef = $rule.definition,2110$closingBraces = '';2111var $compile, $inline, $macro, $ruleValidate, $validateCode;2112if ($isData && $rDef.$data) {2113$validateCode = 'keywordValidate' + $lvl;2114var $validateSchema = $rDef.validateSchema;2115out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;';2116} else {2117$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);2118if (!$ruleValidate) return;2119$schemaValue = 'validate.schema' + $schemaPath;2120$validateCode = $ruleValidate.code;2121$compile = $rDef.compile;2122$inline = $rDef.inline;2123$macro = $rDef.macro;2124}2125var $ruleErrs = $validateCode + '.errors',2126$i = 'i' + $lvl,2127$ruleErr = 'ruleErr' + $lvl,2128$asyncKeyword = $rDef.async;2129if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema');2130if (!($inline || $macro)) {2131out += '' + ($ruleErrs) + ' = null;';2132}2133out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';2134if ($isData && $rDef.$data) {2135$closingBraces += '}';2136out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { ';2137if ($validateSchema) {2138$closingBraces += '}';2139out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { ';2140}2141}2142if ($inline) {2143if ($rDef.statements) {2144out += ' ' + ($ruleValidate.validate) + ' ';2145} else {2146out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; ';2147}2148} else if ($macro) {2149var $it = it.util.copy(it);2150var $closingBraces = '';2151$it.level++;2152var $nextValid = 'valid' + $it.level;2153$it.schema = $ruleValidate.validate;2154$it.schemaPath = '';2155var $wasComposite = it.compositeRule;2156it.compositeRule = $it.compositeRule = true;2157var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);2158it.compositeRule = $it.compositeRule = $wasComposite;2159out += ' ' + ($code);2160} else {2161var $$outStack = $$outStack || [];2162$$outStack.push(out);2163out = '';2164out += ' ' + ($validateCode) + '.call( ';2165if (it.opts.passContext) {2166out += 'this';2167} else {2168out += 'self';2169}2170if ($compile || $rDef.schema === false) {2171out += ' , ' + ($data) + ' ';2172} else {2173out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' ';2174}2175out += ' , (dataPath || \'\')';2176if (it.errorPath != '""') {2177out += ' + ' + (it.errorPath);2178}2179var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',2180$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';2181out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) ';2182var def_callRuleValidate = out;2183out = $$outStack.pop();2184if ($rDef.errors === false) {2185out += ' ' + ($valid) + ' = ';2186if ($asyncKeyword) {2187out += 'await ';2188}2189out += '' + (def_callRuleValidate) + '; ';2190} else {2191if ($asyncKeyword) {2192$ruleErrs = 'customErrors' + $lvl;2193out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';2194} else {2195out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';2196}2197}2198}2199if ($rDef.modifying) {2200out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];';2201}2202out += '' + ($closingBraces);2203if ($rDef.valid) {2204if ($breakOnError) {2205out += ' if (true) { ';2206}2207} else {2208out += ' if ( ';2209if ($rDef.valid === undefined) {2210out += ' !';2211if ($macro) {2212out += '' + ($nextValid);2213} else {2214out += '' + ($valid);2215}2216} else {2217out += ' ' + (!$rDef.valid) + ' ';2218}2219out += ') { ';2220$errorKeyword = $rule.keyword;2221var $$outStack = $$outStack || [];2222$$outStack.push(out);2223out = '';2224var $$outStack = $$outStack || [];2225$$outStack.push(out);2226out = ''; /* istanbul ignore else */2227if (it.createErrors !== false) {2228out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';2229if (it.opts.messages !== false) {2230out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';2231}2232if (it.opts.verbose) {2233out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2234}2235out += ' } ';2236} else {2237out += ' {} ';2238}2239var __err = out;2240out = $$outStack.pop();2241if (!it.compositeRule && $breakOnError) {2242/* istanbul ignore if */2243if (it.async) {2244out += ' throw new ValidationError([' + (__err) + ']); ';2245} else {2246out += ' validate.errors = [' + (__err) + ']; return false; ';2247}2248} else {2249out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2250}2251var def_customError = out;2252out = $$outStack.pop();2253if ($inline) {2254if ($rDef.errors) {2255if ($rDef.errors != 'full') {2256out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';2257if (it.opts.verbose) {2258out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';2259}2260out += ' } ';2261}2262} else {2263if ($rDef.errors === false) {2264out += ' ' + (def_customError) + ' ';2265} else {2266out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';2267if (it.opts.verbose) {2268out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';2269}2270out += ' } } ';2271}2272}2273} else if ($macro) {2274out += ' var err = '; /* istanbul ignore else */2275if (it.createErrors !== false) {2276out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';2277if (it.opts.messages !== false) {2278out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';2279}2280if (it.opts.verbose) {2281out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2282}2283out += ' } ';2284} else {2285out += ' {} ';2286}2287out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2288if (!it.compositeRule && $breakOnError) {2289/* istanbul ignore if */2290if (it.async) {2291out += ' throw new ValidationError(vErrors); ';2292} else {2293out += ' validate.errors = vErrors; return false; ';2294}2295}2296} else {2297if ($rDef.errors === false) {2298out += ' ' + (def_customError) + ' ';2299} else {2300out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; ';2301if (it.opts.verbose) {2302out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';2303}2304out += ' } } else { ' + (def_customError) + ' } ';2305}2306}2307out += ' } ';2308if ($breakOnError) {2309out += ' else { ';2310}2311}2312return out;2313}23142315},{}],23:[function(require,module,exports){2316'use strict';2317module.exports = function generate_dependencies(it, $keyword, $ruleType) {2318var out = ' ';2319var $lvl = it.level;2320var $dataLvl = it.dataLevel;2321var $schema = it.schema[$keyword];2322var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2323var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2324var $breakOnError = !it.opts.allErrors;2325var $data = 'data' + ($dataLvl || '');2326var $errs = 'errs__' + $lvl;2327var $it = it.util.copy(it);2328var $closingBraces = '';2329$it.level++;2330var $nextValid = 'valid' + $it.level;2331var $schemaDeps = {},2332$propertyDeps = {},2333$ownProperties = it.opts.ownProperties;2334for ($property in $schema) {2335if ($property == '__proto__') continue;2336var $sch = $schema[$property];2337var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;2338$deps[$property] = $sch;2339}2340out += 'var ' + ($errs) + ' = errors;';2341var $currentErrorPath = it.errorPath;2342out += 'var missing' + ($lvl) + ';';2343for (var $property in $propertyDeps) {2344$deps = $propertyDeps[$property];2345if ($deps.length) {2346out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';2347if ($ownProperties) {2348out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';2349}2350if ($breakOnError) {2351out += ' && ( ';2352var arr1 = $deps;2353if (arr1) {2354var $propertyKey, $i = -1,2355l1 = arr1.length - 1;2356while ($i < l1) {2357$propertyKey = arr1[$i += 1];2358if ($i) {2359out += ' || ';2360}2361var $prop = it.util.getProperty($propertyKey),2362$useData = $data + $prop;2363out += ' ( ( ' + ($useData) + ' === undefined ';2364if ($ownProperties) {2365out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';2366}2367out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';2368}2369}2370out += ')) { ';2371var $propertyPath = 'missing' + $lvl,2372$missingProperty = '\' + ' + $propertyPath + ' + \'';2373if (it.opts._errorDataPathProperty) {2374it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;2375}2376var $$outStack = $$outStack || [];2377$$outStack.push(out);2378out = ''; /* istanbul ignore else */2379if (it.createErrors !== false) {2380out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';2381if (it.opts.messages !== false) {2382out += ' , message: \'should have ';2383if ($deps.length == 1) {2384out += 'property ' + (it.util.escapeQuotes($deps[0]));2385} else {2386out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));2387}2388out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';2389}2390if (it.opts.verbose) {2391out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2392}2393out += ' } ';2394} else {2395out += ' {} ';2396}2397var __err = out;2398out = $$outStack.pop();2399if (!it.compositeRule && $breakOnError) {2400/* istanbul ignore if */2401if (it.async) {2402out += ' throw new ValidationError([' + (__err) + ']); ';2403} else {2404out += ' validate.errors = [' + (__err) + ']; return false; ';2405}2406} else {2407out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2408}2409} else {2410out += ' ) { ';2411var arr2 = $deps;2412if (arr2) {2413var $propertyKey, i2 = -1,2414l2 = arr2.length - 1;2415while (i2 < l2) {2416$propertyKey = arr2[i2 += 1];2417var $prop = it.util.getProperty($propertyKey),2418$missingProperty = it.util.escapeQuotes($propertyKey),2419$useData = $data + $prop;2420if (it.opts._errorDataPathProperty) {2421it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);2422}2423out += ' if ( ' + ($useData) + ' === undefined ';2424if ($ownProperties) {2425out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';2426}2427out += ') { var err = '; /* istanbul ignore else */2428if (it.createErrors !== false) {2429out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';2430if (it.opts.messages !== false) {2431out += ' , message: \'should have ';2432if ($deps.length == 1) {2433out += 'property ' + (it.util.escapeQuotes($deps[0]));2434} else {2435out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));2436}2437out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';2438}2439if (it.opts.verbose) {2440out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2441}2442out += ' } ';2443} else {2444out += ' {} ';2445}2446out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';2447}2448}2449}2450out += ' } ';2451if ($breakOnError) {2452$closingBraces += '}';2453out += ' else { ';2454}2455}2456}2457it.errorPath = $currentErrorPath;2458var $currentBaseId = $it.baseId;2459for (var $property in $schemaDeps) {2460var $sch = $schemaDeps[$property];2461if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {2462out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';2463if ($ownProperties) {2464out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';2465}2466out += ') { ';2467$it.schema = $sch;2468$it.schemaPath = $schemaPath + it.util.getProperty($property);2469$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);2470out += ' ' + (it.validate($it)) + ' ';2471$it.baseId = $currentBaseId;2472out += ' } ';2473if ($breakOnError) {2474out += ' if (' + ($nextValid) + ') { ';2475$closingBraces += '}';2476}2477}2478}2479if ($breakOnError) {2480out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';2481}2482return out;2483}24842485},{}],24:[function(require,module,exports){2486'use strict';2487module.exports = function generate_enum(it, $keyword, $ruleType) {2488var out = ' ';2489var $lvl = it.level;2490var $dataLvl = it.dataLevel;2491var $schema = it.schema[$keyword];2492var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2493var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2494var $breakOnError = !it.opts.allErrors;2495var $data = 'data' + ($dataLvl || '');2496var $valid = 'valid' + $lvl;2497var $isData = it.opts.$data && $schema && $schema.$data,2498$schemaValue;2499if ($isData) {2500out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';2501$schemaValue = 'schema' + $lvl;2502} else {2503$schemaValue = $schema;2504}2505var $i = 'i' + $lvl,2506$vSchema = 'schema' + $lvl;2507if (!$isData) {2508out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';2509}2510out += 'var ' + ($valid) + ';';2511if ($isData) {2512out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';2513}2514out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';2515if ($isData) {2516out += ' } ';2517}2518out += ' if (!' + ($valid) + ') { ';2519var $$outStack = $$outStack || [];2520$$outStack.push(out);2521out = ''; /* istanbul ignore else */2522if (it.createErrors !== false) {2523out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';2524if (it.opts.messages !== false) {2525out += ' , message: \'should be equal to one of the allowed values\' ';2526}2527if (it.opts.verbose) {2528out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2529}2530out += ' } ';2531} else {2532out += ' {} ';2533}2534var __err = out;2535out = $$outStack.pop();2536if (!it.compositeRule && $breakOnError) {2537/* istanbul ignore if */2538if (it.async) {2539out += ' throw new ValidationError([' + (__err) + ']); ';2540} else {2541out += ' validate.errors = [' + (__err) + ']; return false; ';2542}2543} else {2544out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2545}2546out += ' }';2547if ($breakOnError) {2548out += ' else { ';2549}2550return out;2551}25522553},{}],25:[function(require,module,exports){2554'use strict';2555module.exports = function generate_format(it, $keyword, $ruleType) {2556var out = ' ';2557var $lvl = it.level;2558var $dataLvl = it.dataLevel;2559var $schema = it.schema[$keyword];2560var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2561var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2562var $breakOnError = !it.opts.allErrors;2563var $data = 'data' + ($dataLvl || '');2564if (it.opts.format === false) {2565if ($breakOnError) {2566out += ' if (true) { ';2567}2568return out;2569}2570var $isData = it.opts.$data && $schema && $schema.$data,2571$schemaValue;2572if ($isData) {2573out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';2574$schemaValue = 'schema' + $lvl;2575} else {2576$schemaValue = $schema;2577}2578var $unknownFormats = it.opts.unknownFormats,2579$allowUnknown = Array.isArray($unknownFormats);2580if ($isData) {2581var $format = 'format' + $lvl,2582$isObject = 'isObject' + $lvl,2583$formatType = 'formatType' + $lvl;2584out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { ';2585if (it.async) {2586out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';2587}2588out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';2589if ($isData) {2590out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';2591}2592out += ' (';2593if ($unknownFormats != 'ignore') {2594out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';2595if ($allowUnknown) {2596out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';2597}2598out += ') || ';2599}2600out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? ';2601if (it.async) {2602out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';2603} else {2604out += ' ' + ($format) + '(' + ($data) + ') ';2605}2606out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';2607} else {2608var $format = it.formats[$schema];2609if (!$format) {2610if ($unknownFormats == 'ignore') {2611it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');2612if ($breakOnError) {2613out += ' if (true) { ';2614}2615return out;2616} else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) {2617if ($breakOnError) {2618out += ' if (true) { ';2619}2620return out;2621} else {2622throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"');2623}2624}2625var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;2626var $formatType = $isObject && $format.type || 'string';2627if ($isObject) {2628var $async = $format.async === true;2629$format = $format.validate;2630}2631if ($formatType != $ruleType) {2632if ($breakOnError) {2633out += ' if (true) { ';2634}2635return out;2636}2637if ($async) {2638if (!it.async) throw new Error('async format in sync schema');2639var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';2640out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { ';2641} else {2642out += ' if (! ';2643var $formatRef = 'formats' + it.util.getProperty($schema);2644if ($isObject) $formatRef += '.validate';2645if (typeof $format == 'function') {2646out += ' ' + ($formatRef) + '(' + ($data) + ') ';2647} else {2648out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';2649}2650out += ') { ';2651}2652}2653var $$outStack = $$outStack || [];2654$$outStack.push(out);2655out = ''; /* istanbul ignore else */2656if (it.createErrors !== false) {2657out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';2658if ($isData) {2659out += '' + ($schemaValue);2660} else {2661out += '' + (it.util.toQuotedString($schema));2662}2663out += ' } ';2664if (it.opts.messages !== false) {2665out += ' , message: \'should match format "';2666if ($isData) {2667out += '\' + ' + ($schemaValue) + ' + \'';2668} else {2669out += '' + (it.util.escapeQuotes($schema));2670}2671out += '"\' ';2672}2673if (it.opts.verbose) {2674out += ' , schema: ';2675if ($isData) {2676out += 'validate.schema' + ($schemaPath);2677} else {2678out += '' + (it.util.toQuotedString($schema));2679}2680out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2681}2682out += ' } ';2683} else {2684out += ' {} ';2685}2686var __err = out;2687out = $$outStack.pop();2688if (!it.compositeRule && $breakOnError) {2689/* istanbul ignore if */2690if (it.async) {2691out += ' throw new ValidationError([' + (__err) + ']); ';2692} else {2693out += ' validate.errors = [' + (__err) + ']; return false; ';2694}2695} else {2696out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2697}2698out += ' } ';2699if ($breakOnError) {2700out += ' else { ';2701}2702return out;2703}27042705},{}],26:[function(require,module,exports){2706'use strict';2707module.exports = function generate_if(it, $keyword, $ruleType) {2708var out = ' ';2709var $lvl = it.level;2710var $dataLvl = it.dataLevel;2711var $schema = it.schema[$keyword];2712var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2713var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2714var $breakOnError = !it.opts.allErrors;2715var $data = 'data' + ($dataLvl || '');2716var $valid = 'valid' + $lvl;2717var $errs = 'errs__' + $lvl;2718var $it = it.util.copy(it);2719$it.level++;2720var $nextValid = 'valid' + $it.level;2721var $thenSch = it.schema['then'],2722$elseSch = it.schema['else'],2723$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),2724$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),2725$currentBaseId = $it.baseId;2726if ($thenPresent || $elsePresent) {2727var $ifClause;2728$it.createErrors = false;2729$it.schema = $schema;2730$it.schemaPath = $schemaPath;2731$it.errSchemaPath = $errSchemaPath;2732out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';2733var $wasComposite = it.compositeRule;2734it.compositeRule = $it.compositeRule = true;2735out += ' ' + (it.validate($it)) + ' ';2736$it.baseId = $currentBaseId;2737$it.createErrors = true;2738out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';2739it.compositeRule = $it.compositeRule = $wasComposite;2740if ($thenPresent) {2741out += ' if (' + ($nextValid) + ') { ';2742$it.schema = it.schema['then'];2743$it.schemaPath = it.schemaPath + '.then';2744$it.errSchemaPath = it.errSchemaPath + '/then';2745out += ' ' + (it.validate($it)) + ' ';2746$it.baseId = $currentBaseId;2747out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';2748if ($thenPresent && $elsePresent) {2749$ifClause = 'ifClause' + $lvl;2750out += ' var ' + ($ifClause) + ' = \'then\'; ';2751} else {2752$ifClause = '\'then\'';2753}2754out += ' } ';2755if ($elsePresent) {2756out += ' else { ';2757}2758} else {2759out += ' if (!' + ($nextValid) + ') { ';2760}2761if ($elsePresent) {2762$it.schema = it.schema['else'];2763$it.schemaPath = it.schemaPath + '.else';2764$it.errSchemaPath = it.errSchemaPath + '/else';2765out += ' ' + (it.validate($it)) + ' ';2766$it.baseId = $currentBaseId;2767out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';2768if ($thenPresent && $elsePresent) {2769$ifClause = 'ifClause' + $lvl;2770out += ' var ' + ($ifClause) + ' = \'else\'; ';2771} else {2772$ifClause = '\'else\'';2773}2774out += ' } ';2775}2776out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */2777if (it.createErrors !== false) {2778out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';2779if (it.opts.messages !== false) {2780out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' ';2781}2782if (it.opts.verbose) {2783out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2784}2785out += ' } ';2786} else {2787out += ' {} ';2788}2789out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2790if (!it.compositeRule && $breakOnError) {2791/* istanbul ignore if */2792if (it.async) {2793out += ' throw new ValidationError(vErrors); ';2794} else {2795out += ' validate.errors = vErrors; return false; ';2796}2797}2798out += ' } ';2799if ($breakOnError) {2800out += ' else { ';2801}2802} else {2803if ($breakOnError) {2804out += ' if (true) { ';2805}2806}2807return out;2808}28092810},{}],27:[function(require,module,exports){2811'use strict';28122813//all requires must be explicit because browserify won't work with dynamic requires2814module.exports = {2815'$ref': require('./ref'),2816allOf: require('./allOf'),2817anyOf: require('./anyOf'),2818'$comment': require('./comment'),2819const: require('./const'),2820contains: require('./contains'),2821dependencies: require('./dependencies'),2822'enum': require('./enum'),2823format: require('./format'),2824'if': require('./if'),2825items: require('./items'),2826maximum: require('./_limit'),2827minimum: require('./_limit'),2828maxItems: require('./_limitItems'),2829minItems: require('./_limitItems'),2830maxLength: require('./_limitLength'),2831minLength: require('./_limitLength'),2832maxProperties: require('./_limitProperties'),2833minProperties: require('./_limitProperties'),2834multipleOf: require('./multipleOf'),2835not: require('./not'),2836oneOf: require('./oneOf'),2837pattern: require('./pattern'),2838properties: require('./properties'),2839propertyNames: require('./propertyNames'),2840required: require('./required'),2841uniqueItems: require('./uniqueItems'),2842validate: require('./validate')2843};28442845},{"./_limit":13,"./_limitItems":14,"./_limitLength":15,"./_limitProperties":16,"./allOf":17,"./anyOf":18,"./comment":19,"./const":20,"./contains":21,"./dependencies":23,"./enum":24,"./format":25,"./if":26,"./items":28,"./multipleOf":29,"./not":30,"./oneOf":31,"./pattern":32,"./properties":33,"./propertyNames":34,"./ref":35,"./required":36,"./uniqueItems":37,"./validate":38}],28:[function(require,module,exports){2846'use strict';2847module.exports = function generate_items(it, $keyword, $ruleType) {2848var out = ' ';2849var $lvl = it.level;2850var $dataLvl = it.dataLevel;2851var $schema = it.schema[$keyword];2852var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2853var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2854var $breakOnError = !it.opts.allErrors;2855var $data = 'data' + ($dataLvl || '');2856var $valid = 'valid' + $lvl;2857var $errs = 'errs__' + $lvl;2858var $it = it.util.copy(it);2859var $closingBraces = '';2860$it.level++;2861var $nextValid = 'valid' + $it.level;2862var $idx = 'i' + $lvl,2863$dataNxt = $it.dataLevel = it.dataLevel + 1,2864$nextData = 'data' + $dataNxt,2865$currentBaseId = it.baseId;2866out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';2867if (Array.isArray($schema)) {2868var $additionalItems = it.schema.additionalItems;2869if ($additionalItems === false) {2870out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';2871var $currErrSchemaPath = $errSchemaPath;2872$errSchemaPath = it.errSchemaPath + '/additionalItems';2873out += ' if (!' + ($valid) + ') { ';2874var $$outStack = $$outStack || [];2875$$outStack.push(out);2876out = ''; /* istanbul ignore else */2877if (it.createErrors !== false) {2878out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';2879if (it.opts.messages !== false) {2880out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' ';2881}2882if (it.opts.verbose) {2883out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';2884}2885out += ' } ';2886} else {2887out += ' {} ';2888}2889var __err = out;2890out = $$outStack.pop();2891if (!it.compositeRule && $breakOnError) {2892/* istanbul ignore if */2893if (it.async) {2894out += ' throw new ValidationError([' + (__err) + ']); ';2895} else {2896out += ' validate.errors = [' + (__err) + ']; return false; ';2897}2898} else {2899out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';2900}2901out += ' } ';2902$errSchemaPath = $currErrSchemaPath;2903if ($breakOnError) {2904$closingBraces += '}';2905out += ' else { ';2906}2907}2908var arr1 = $schema;2909if (arr1) {2910var $sch, $i = -1,2911l1 = arr1.length - 1;2912while ($i < l1) {2913$sch = arr1[$i += 1];2914if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {2915out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';2916var $passData = $data + '[' + $i + ']';2917$it.schema = $sch;2918$it.schemaPath = $schemaPath + '[' + $i + ']';2919$it.errSchemaPath = $errSchemaPath + '/' + $i;2920$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);2921$it.dataPathArr[$dataNxt] = $i;2922var $code = it.validate($it);2923$it.baseId = $currentBaseId;2924if (it.util.varOccurences($code, $nextData) < 2) {2925out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';2926} else {2927out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';2928}2929out += ' } ';2930if ($breakOnError) {2931out += ' if (' + ($nextValid) + ') { ';2932$closingBraces += '}';2933}2934}2935}2936}2937if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {2938$it.schema = $additionalItems;2939$it.schemaPath = it.schemaPath + '.additionalItems';2940$it.errSchemaPath = it.errSchemaPath + '/additionalItems';2941out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';2942$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);2943var $passData = $data + '[' + $idx + ']';2944$it.dataPathArr[$dataNxt] = $idx;2945var $code = it.validate($it);2946$it.baseId = $currentBaseId;2947if (it.util.varOccurences($code, $nextData) < 2) {2948out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';2949} else {2950out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';2951}2952if ($breakOnError) {2953out += ' if (!' + ($nextValid) + ') break; ';2954}2955out += ' } } ';2956if ($breakOnError) {2957out += ' if (' + ($nextValid) + ') { ';2958$closingBraces += '}';2959}2960}2961} else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {2962$it.schema = $schema;2963$it.schemaPath = $schemaPath;2964$it.errSchemaPath = $errSchemaPath;2965out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';2966$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);2967var $passData = $data + '[' + $idx + ']';2968$it.dataPathArr[$dataNxt] = $idx;2969var $code = it.validate($it);2970$it.baseId = $currentBaseId;2971if (it.util.varOccurences($code, $nextData) < 2) {2972out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';2973} else {2974out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';2975}2976if ($breakOnError) {2977out += ' if (!' + ($nextValid) + ') break; ';2978}2979out += ' }';2980}2981if ($breakOnError) {2982out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';2983}2984return out;2985}29862987},{}],29:[function(require,module,exports){2988'use strict';2989module.exports = function generate_multipleOf(it, $keyword, $ruleType) {2990var out = ' ';2991var $lvl = it.level;2992var $dataLvl = it.dataLevel;2993var $schema = it.schema[$keyword];2994var $schemaPath = it.schemaPath + it.util.getProperty($keyword);2995var $errSchemaPath = it.errSchemaPath + '/' + $keyword;2996var $breakOnError = !it.opts.allErrors;2997var $data = 'data' + ($dataLvl || '');2998var $isData = it.opts.$data && $schema && $schema.$data,2999$schemaValue;3000if ($isData) {3001out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';3002$schemaValue = 'schema' + $lvl;3003} else {3004$schemaValue = $schema;3005}3006if (!($isData || typeof $schema == 'number')) {3007throw new Error($keyword + ' must be number');3008}3009out += 'var division' + ($lvl) + ';if (';3010if ($isData) {3011out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';3012}3013out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';3014if (it.opts.multipleOfPrecision) {3015out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';3016} else {3017out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';3018}3019out += ' ) ';3020if ($isData) {3021out += ' ) ';3022}3023out += ' ) { ';3024var $$outStack = $$outStack || [];3025$$outStack.push(out);3026out = ''; /* istanbul ignore else */3027if (it.createErrors !== false) {3028out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';3029if (it.opts.messages !== false) {3030out += ' , message: \'should be multiple of ';3031if ($isData) {3032out += '\' + ' + ($schemaValue);3033} else {3034out += '' + ($schemaValue) + '\'';3035}3036}3037if (it.opts.verbose) {3038out += ' , schema: ';3039if ($isData) {3040out += 'validate.schema' + ($schemaPath);3041} else {3042out += '' + ($schema);3043}3044out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3045}3046out += ' } ';3047} else {3048out += ' {} ';3049}3050var __err = out;3051out = $$outStack.pop();3052if (!it.compositeRule && $breakOnError) {3053/* istanbul ignore if */3054if (it.async) {3055out += ' throw new ValidationError([' + (__err) + ']); ';3056} else {3057out += ' validate.errors = [' + (__err) + ']; return false; ';3058}3059} else {3060out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3061}3062out += '} ';3063if ($breakOnError) {3064out += ' else { ';3065}3066return out;3067}30683069},{}],30:[function(require,module,exports){3070'use strict';3071module.exports = function generate_not(it, $keyword, $ruleType) {3072var out = ' ';3073var $lvl = it.level;3074var $dataLvl = it.dataLevel;3075var $schema = it.schema[$keyword];3076var $schemaPath = it.schemaPath + it.util.getProperty($keyword);3077var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3078var $breakOnError = !it.opts.allErrors;3079var $data = 'data' + ($dataLvl || '');3080var $errs = 'errs__' + $lvl;3081var $it = it.util.copy(it);3082$it.level++;3083var $nextValid = 'valid' + $it.level;3084if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {3085$it.schema = $schema;3086$it.schemaPath = $schemaPath;3087$it.errSchemaPath = $errSchemaPath;3088out += ' var ' + ($errs) + ' = errors; ';3089var $wasComposite = it.compositeRule;3090it.compositeRule = $it.compositeRule = true;3091$it.createErrors = false;3092var $allErrorsOption;3093if ($it.opts.allErrors) {3094$allErrorsOption = $it.opts.allErrors;3095$it.opts.allErrors = false;3096}3097out += ' ' + (it.validate($it)) + ' ';3098$it.createErrors = true;3099if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;3100it.compositeRule = $it.compositeRule = $wasComposite;3101out += ' if (' + ($nextValid) + ') { ';3102var $$outStack = $$outStack || [];3103$$outStack.push(out);3104out = ''; /* istanbul ignore else */3105if (it.createErrors !== false) {3106out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';3107if (it.opts.messages !== false) {3108out += ' , message: \'should NOT be valid\' ';3109}3110if (it.opts.verbose) {3111out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3112}3113out += ' } ';3114} else {3115out += ' {} ';3116}3117var __err = out;3118out = $$outStack.pop();3119if (!it.compositeRule && $breakOnError) {3120/* istanbul ignore if */3121if (it.async) {3122out += ' throw new ValidationError([' + (__err) + ']); ';3123} else {3124out += ' validate.errors = [' + (__err) + ']; return false; ';3125}3126} else {3127out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3128}3129out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';3130if (it.opts.allErrors) {3131out += ' } ';3132}3133} else {3134out += ' var err = '; /* istanbul ignore else */3135if (it.createErrors !== false) {3136out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';3137if (it.opts.messages !== false) {3138out += ' , message: \'should NOT be valid\' ';3139}3140if (it.opts.verbose) {3141out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3142}3143out += ' } ';3144} else {3145out += ' {} ';3146}3147out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3148if ($breakOnError) {3149out += ' if (false) { ';3150}3151}3152return out;3153}31543155},{}],31:[function(require,module,exports){3156'use strict';3157module.exports = function generate_oneOf(it, $keyword, $ruleType) {3158var out = ' ';3159var $lvl = it.level;3160var $dataLvl = it.dataLevel;3161var $schema = it.schema[$keyword];3162var $schemaPath = it.schemaPath + it.util.getProperty($keyword);3163var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3164var $breakOnError = !it.opts.allErrors;3165var $data = 'data' + ($dataLvl || '');3166var $valid = 'valid' + $lvl;3167var $errs = 'errs__' + $lvl;3168var $it = it.util.copy(it);3169var $closingBraces = '';3170$it.level++;3171var $nextValid = 'valid' + $it.level;3172var $currentBaseId = $it.baseId,3173$prevValid = 'prevValid' + $lvl,3174$passingSchemas = 'passingSchemas' + $lvl;3175out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';3176var $wasComposite = it.compositeRule;3177it.compositeRule = $it.compositeRule = true;3178var arr1 = $schema;3179if (arr1) {3180var $sch, $i = -1,3181l1 = arr1.length - 1;3182while ($i < l1) {3183$sch = arr1[$i += 1];3184if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {3185$it.schema = $sch;3186$it.schemaPath = $schemaPath + '[' + $i + ']';3187$it.errSchemaPath = $errSchemaPath + '/' + $i;3188out += ' ' + (it.validate($it)) + ' ';3189$it.baseId = $currentBaseId;3190} else {3191out += ' var ' + ($nextValid) + ' = true; ';3192}3193if ($i) {3194out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';3195$closingBraces += '}';3196}3197out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';3198}3199}3200it.compositeRule = $it.compositeRule = $wasComposite;3201out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */3202if (it.createErrors !== false) {3203out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';3204if (it.opts.messages !== false) {3205out += ' , message: \'should match exactly one schema in oneOf\' ';3206}3207if (it.opts.verbose) {3208out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3209}3210out += ' } ';3211} else {3212out += ' {} ';3213}3214out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3215if (!it.compositeRule && $breakOnError) {3216/* istanbul ignore if */3217if (it.async) {3218out += ' throw new ValidationError(vErrors); ';3219} else {3220out += ' validate.errors = vErrors; return false; ';3221}3222}3223out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';3224if (it.opts.allErrors) {3225out += ' } ';3226}3227return out;3228}32293230},{}],32:[function(require,module,exports){3231'use strict';3232module.exports = function generate_pattern(it, $keyword, $ruleType) {3233var out = ' ';3234var $lvl = it.level;3235var $dataLvl = it.dataLevel;3236var $schema = it.schema[$keyword];3237var $schemaPath = it.schemaPath + it.util.getProperty($keyword);3238var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3239var $breakOnError = !it.opts.allErrors;3240var $data = 'data' + ($dataLvl || '');3241var $isData = it.opts.$data && $schema && $schema.$data,3242$schemaValue;3243if ($isData) {3244out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';3245$schemaValue = 'schema' + $lvl;3246} else {3247$schemaValue = $schema;3248}3249var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);3250out += 'if ( ';3251if ($isData) {3252out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';3253}3254out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';3255var $$outStack = $$outStack || [];3256$$outStack.push(out);3257out = ''; /* istanbul ignore else */3258if (it.createErrors !== false) {3259out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';3260if ($isData) {3261out += '' + ($schemaValue);3262} else {3263out += '' + (it.util.toQuotedString($schema));3264}3265out += ' } ';3266if (it.opts.messages !== false) {3267out += ' , message: \'should match pattern "';3268if ($isData) {3269out += '\' + ' + ($schemaValue) + ' + \'';3270} else {3271out += '' + (it.util.escapeQuotes($schema));3272}3273out += '"\' ';3274}3275if (it.opts.verbose) {3276out += ' , schema: ';3277if ($isData) {3278out += 'validate.schema' + ($schemaPath);3279} else {3280out += '' + (it.util.toQuotedString($schema));3281}3282out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3283}3284out += ' } ';3285} else {3286out += ' {} ';3287}3288var __err = out;3289out = $$outStack.pop();3290if (!it.compositeRule && $breakOnError) {3291/* istanbul ignore if */3292if (it.async) {3293out += ' throw new ValidationError([' + (__err) + ']); ';3294} else {3295out += ' validate.errors = [' + (__err) + ']; return false; ';3296}3297} else {3298out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3299}3300out += '} ';3301if ($breakOnError) {3302out += ' else { ';3303}3304return out;3305}33063307},{}],33:[function(require,module,exports){3308'use strict';3309module.exports = function generate_properties(it, $keyword, $ruleType) {3310var out = ' ';3311var $lvl = it.level;3312var $dataLvl = it.dataLevel;3313var $schema = it.schema[$keyword];3314var $schemaPath = it.schemaPath + it.util.getProperty($keyword);3315var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3316var $breakOnError = !it.opts.allErrors;3317var $data = 'data' + ($dataLvl || '');3318var $errs = 'errs__' + $lvl;3319var $it = it.util.copy(it);3320var $closingBraces = '';3321$it.level++;3322var $nextValid = 'valid' + $it.level;3323var $key = 'key' + $lvl,3324$idx = 'idx' + $lvl,3325$dataNxt = $it.dataLevel = it.dataLevel + 1,3326$nextData = 'data' + $dataNxt,3327$dataProperties = 'dataProperties' + $lvl;3328var $schemaKeys = Object.keys($schema || {}).filter(notProto),3329$pProperties = it.schema.patternProperties || {},3330$pPropertyKeys = Object.keys($pProperties).filter(notProto),3331$aProperties = it.schema.additionalProperties,3332$someProperties = $schemaKeys.length || $pPropertyKeys.length,3333$noAdditional = $aProperties === false,3334$additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,3335$removeAdditional = it.opts.removeAdditional,3336$checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,3337$ownProperties = it.opts.ownProperties,3338$currentBaseId = it.baseId;3339var $required = it.schema.required;3340if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {3341var $requiredHash = it.util.toHash($required);3342}33433344function notProto(p) {3345return p !== '__proto__';3346}3347out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';3348if ($ownProperties) {3349out += ' var ' + ($dataProperties) + ' = undefined;';3350}3351if ($checkAdditional) {3352if ($ownProperties) {3353out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';3354} else {3355out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';3356}3357if ($someProperties) {3358out += ' var isAdditional' + ($lvl) + ' = !(false ';3359if ($schemaKeys.length) {3360if ($schemaKeys.length > 8) {3361out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';3362} else {3363var arr1 = $schemaKeys;3364if (arr1) {3365var $propertyKey, i1 = -1,3366l1 = arr1.length - 1;3367while (i1 < l1) {3368$propertyKey = arr1[i1 += 1];3369out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';3370}3371}3372}3373}3374if ($pPropertyKeys.length) {3375var arr2 = $pPropertyKeys;3376if (arr2) {3377var $pProperty, $i = -1,3378l2 = arr2.length - 1;3379while ($i < l2) {3380$pProperty = arr2[$i += 1];3381out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';3382}3383}3384}3385out += ' ); if (isAdditional' + ($lvl) + ') { ';3386}3387if ($removeAdditional == 'all') {3388out += ' delete ' + ($data) + '[' + ($key) + ']; ';3389} else {3390var $currentErrorPath = it.errorPath;3391var $additionalProperty = '\' + ' + $key + ' + \'';3392if (it.opts._errorDataPathProperty) {3393it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);3394}3395if ($noAdditional) {3396if ($removeAdditional) {3397out += ' delete ' + ($data) + '[' + ($key) + ']; ';3398} else {3399out += ' ' + ($nextValid) + ' = false; ';3400var $currErrSchemaPath = $errSchemaPath;3401$errSchemaPath = it.errSchemaPath + '/additionalProperties';3402var $$outStack = $$outStack || [];3403$$outStack.push(out);3404out = ''; /* istanbul ignore else */3405if (it.createErrors !== false) {3406out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';3407if (it.opts.messages !== false) {3408out += ' , message: \'';3409if (it.opts._errorDataPathProperty) {3410out += 'is an invalid additional property';3411} else {3412out += 'should NOT have additional properties';3413}3414out += '\' ';3415}3416if (it.opts.verbose) {3417out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3418}3419out += ' } ';3420} else {3421out += ' {} ';3422}3423var __err = out;3424out = $$outStack.pop();3425if (!it.compositeRule && $breakOnError) {3426/* istanbul ignore if */3427if (it.async) {3428out += ' throw new ValidationError([' + (__err) + ']); ';3429} else {3430out += ' validate.errors = [' + (__err) + ']; return false; ';3431}3432} else {3433out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3434}3435$errSchemaPath = $currErrSchemaPath;3436if ($breakOnError) {3437out += ' break; ';3438}3439}3440} else if ($additionalIsSchema) {3441if ($removeAdditional == 'failing') {3442out += ' var ' + ($errs) + ' = errors; ';3443var $wasComposite = it.compositeRule;3444it.compositeRule = $it.compositeRule = true;3445$it.schema = $aProperties;3446$it.schemaPath = it.schemaPath + '.additionalProperties';3447$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';3448$it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);3449var $passData = $data + '[' + $key + ']';3450$it.dataPathArr[$dataNxt] = $key;3451var $code = it.validate($it);3452$it.baseId = $currentBaseId;3453if (it.util.varOccurences($code, $nextData) < 2) {3454out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';3455} else {3456out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';3457}3458out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';3459it.compositeRule = $it.compositeRule = $wasComposite;3460} else {3461$it.schema = $aProperties;3462$it.schemaPath = it.schemaPath + '.additionalProperties';3463$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';3464$it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);3465var $passData = $data + '[' + $key + ']';3466$it.dataPathArr[$dataNxt] = $key;3467var $code = it.validate($it);3468$it.baseId = $currentBaseId;3469if (it.util.varOccurences($code, $nextData) < 2) {3470out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';3471} else {3472out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';3473}3474if ($breakOnError) {3475out += ' if (!' + ($nextValid) + ') break; ';3476}3477}3478}3479it.errorPath = $currentErrorPath;3480}3481if ($someProperties) {3482out += ' } ';3483}3484out += ' } ';3485if ($breakOnError) {3486out += ' if (' + ($nextValid) + ') { ';3487$closingBraces += '}';3488}3489}3490var $useDefaults = it.opts.useDefaults && !it.compositeRule;3491if ($schemaKeys.length) {3492var arr3 = $schemaKeys;3493if (arr3) {3494var $propertyKey, i3 = -1,3495l3 = arr3.length - 1;3496while (i3 < l3) {3497$propertyKey = arr3[i3 += 1];3498var $sch = $schema[$propertyKey];3499if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {3500var $prop = it.util.getProperty($propertyKey),3501$passData = $data + $prop,3502$hasDefault = $useDefaults && $sch.default !== undefined;3503$it.schema = $sch;3504$it.schemaPath = $schemaPath + $prop;3505$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);3506$it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);3507$it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);3508var $code = it.validate($it);3509$it.baseId = $currentBaseId;3510if (it.util.varOccurences($code, $nextData) < 2) {3511$code = it.util.varReplace($code, $nextData, $passData);3512var $useData = $passData;3513} else {3514var $useData = $nextData;3515out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';3516}3517if ($hasDefault) {3518out += ' ' + ($code) + ' ';3519} else {3520if ($requiredHash && $requiredHash[$propertyKey]) {3521out += ' if ( ' + ($useData) + ' === undefined ';3522if ($ownProperties) {3523out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';3524}3525out += ') { ' + ($nextValid) + ' = false; ';3526var $currentErrorPath = it.errorPath,3527$currErrSchemaPath = $errSchemaPath,3528$missingProperty = it.util.escapeQuotes($propertyKey);3529if (it.opts._errorDataPathProperty) {3530it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);3531}3532$errSchemaPath = it.errSchemaPath + '/required';3533var $$outStack = $$outStack || [];3534$$outStack.push(out);3535out = ''; /* istanbul ignore else */3536if (it.createErrors !== false) {3537out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';3538if (it.opts.messages !== false) {3539out += ' , message: \'';3540if (it.opts._errorDataPathProperty) {3541out += 'is a required property';3542} else {3543out += 'should have required property \\\'' + ($missingProperty) + '\\\'';3544}3545out += '\' ';3546}3547if (it.opts.verbose) {3548out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3549}3550out += ' } ';3551} else {3552out += ' {} ';3553}3554var __err = out;3555out = $$outStack.pop();3556if (!it.compositeRule && $breakOnError) {3557/* istanbul ignore if */3558if (it.async) {3559out += ' throw new ValidationError([' + (__err) + ']); ';3560} else {3561out += ' validate.errors = [' + (__err) + ']; return false; ';3562}3563} else {3564out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3565}3566$errSchemaPath = $currErrSchemaPath;3567it.errorPath = $currentErrorPath;3568out += ' } else { ';3569} else {3570if ($breakOnError) {3571out += ' if ( ' + ($useData) + ' === undefined ';3572if ($ownProperties) {3573out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';3574}3575out += ') { ' + ($nextValid) + ' = true; } else { ';3576} else {3577out += ' if (' + ($useData) + ' !== undefined ';3578if ($ownProperties) {3579out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';3580}3581out += ' ) { ';3582}3583}3584out += ' ' + ($code) + ' } ';3585}3586}3587if ($breakOnError) {3588out += ' if (' + ($nextValid) + ') { ';3589$closingBraces += '}';3590}3591}3592}3593}3594if ($pPropertyKeys.length) {3595var arr4 = $pPropertyKeys;3596if (arr4) {3597var $pProperty, i4 = -1,3598l4 = arr4.length - 1;3599while (i4 < l4) {3600$pProperty = arr4[i4 += 1];3601var $sch = $pProperties[$pProperty];3602if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {3603$it.schema = $sch;3604$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);3605$it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);3606if ($ownProperties) {3607out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';3608} else {3609out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';3610}3611out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';3612$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);3613var $passData = $data + '[' + $key + ']';3614$it.dataPathArr[$dataNxt] = $key;3615var $code = it.validate($it);3616$it.baseId = $currentBaseId;3617if (it.util.varOccurences($code, $nextData) < 2) {3618out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';3619} else {3620out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';3621}3622if ($breakOnError) {3623out += ' if (!' + ($nextValid) + ') break; ';3624}3625out += ' } ';3626if ($breakOnError) {3627out += ' else ' + ($nextValid) + ' = true; ';3628}3629out += ' } ';3630if ($breakOnError) {3631out += ' if (' + ($nextValid) + ') { ';3632$closingBraces += '}';3633}3634}3635}3636}3637}3638if ($breakOnError) {3639out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';3640}3641return out;3642}36433644},{}],34:[function(require,module,exports){3645'use strict';3646module.exports = function generate_propertyNames(it, $keyword, $ruleType) {3647var out = ' ';3648var $lvl = it.level;3649var $dataLvl = it.dataLevel;3650var $schema = it.schema[$keyword];3651var $schemaPath = it.schemaPath + it.util.getProperty($keyword);3652var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3653var $breakOnError = !it.opts.allErrors;3654var $data = 'data' + ($dataLvl || '');3655var $errs = 'errs__' + $lvl;3656var $it = it.util.copy(it);3657var $closingBraces = '';3658$it.level++;3659var $nextValid = 'valid' + $it.level;3660out += 'var ' + ($errs) + ' = errors;';3661if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {3662$it.schema = $schema;3663$it.schemaPath = $schemaPath;3664$it.errSchemaPath = $errSchemaPath;3665var $key = 'key' + $lvl,3666$idx = 'idx' + $lvl,3667$i = 'i' + $lvl,3668$invalidName = '\' + ' + $key + ' + \'',3669$dataNxt = $it.dataLevel = it.dataLevel + 1,3670$nextData = 'data' + $dataNxt,3671$dataProperties = 'dataProperties' + $lvl,3672$ownProperties = it.opts.ownProperties,3673$currentBaseId = it.baseId;3674if ($ownProperties) {3675out += ' var ' + ($dataProperties) + ' = undefined; ';3676}3677if ($ownProperties) {3678out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';3679} else {3680out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';3681}3682out += ' var startErrs' + ($lvl) + ' = errors; ';3683var $passData = $key;3684var $wasComposite = it.compositeRule;3685it.compositeRule = $it.compositeRule = true;3686var $code = it.validate($it);3687$it.baseId = $currentBaseId;3688if (it.util.varOccurences($code, $nextData) < 2) {3689out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';3690} else {3691out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';3692}3693it.compositeRule = $it.compositeRule = $wasComposite;3694out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + '<errors; ' + ($i) + '++) { vErrors[' + ($i) + '].propertyName = ' + ($key) + '; } var err = '; /* istanbul ignore else */3695if (it.createErrors !== false) {3696out += ' { keyword: \'' + ('propertyNames') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { propertyName: \'' + ($invalidName) + '\' } ';3697if (it.opts.messages !== false) {3698out += ' , message: \'property name \\\'' + ($invalidName) + '\\\' is invalid\' ';3699}3700if (it.opts.verbose) {3701out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3702}3703out += ' } ';3704} else {3705out += ' {} ';3706}3707out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3708if (!it.compositeRule && $breakOnError) {3709/* istanbul ignore if */3710if (it.async) {3711out += ' throw new ValidationError(vErrors); ';3712} else {3713out += ' validate.errors = vErrors; return false; ';3714}3715}3716if ($breakOnError) {3717out += ' break; ';3718}3719out += ' } }';3720}3721if ($breakOnError) {3722out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';3723}3724return out;3725}37263727},{}],35:[function(require,module,exports){3728'use strict';3729module.exports = function generate_ref(it, $keyword, $ruleType) {3730var out = ' ';3731var $lvl = it.level;3732var $dataLvl = it.dataLevel;3733var $schema = it.schema[$keyword];3734var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3735var $breakOnError = !it.opts.allErrors;3736var $data = 'data' + ($dataLvl || '');3737var $valid = 'valid' + $lvl;3738var $async, $refCode;3739if ($schema == '#' || $schema == '#/') {3740if (it.isRoot) {3741$async = it.async;3742$refCode = 'validate';3743} else {3744$async = it.root.schema.$async === true;3745$refCode = 'root.refVal[0]';3746}3747} else {3748var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);3749if ($refVal === undefined) {3750var $message = it.MissingRefError.message(it.baseId, $schema);3751if (it.opts.missingRefs == 'fail') {3752it.logger.error($message);3753var $$outStack = $$outStack || [];3754$$outStack.push(out);3755out = ''; /* istanbul ignore else */3756if (it.createErrors !== false) {3757out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } ';3758if (it.opts.messages !== false) {3759out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';3760}3761if (it.opts.verbose) {3762out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3763}3764out += ' } ';3765} else {3766out += ' {} ';3767}3768var __err = out;3769out = $$outStack.pop();3770if (!it.compositeRule && $breakOnError) {3771/* istanbul ignore if */3772if (it.async) {3773out += ' throw new ValidationError([' + (__err) + ']); ';3774} else {3775out += ' validate.errors = [' + (__err) + ']; return false; ';3776}3777} else {3778out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3779}3780if ($breakOnError) {3781out += ' if (false) { ';3782}3783} else if (it.opts.missingRefs == 'ignore') {3784it.logger.warn($message);3785if ($breakOnError) {3786out += ' if (true) { ';3787}3788} else {3789throw new it.MissingRefError(it.baseId, $schema, $message);3790}3791} else if ($refVal.inline) {3792var $it = it.util.copy(it);3793$it.level++;3794var $nextValid = 'valid' + $it.level;3795$it.schema = $refVal.schema;3796$it.schemaPath = '';3797$it.errSchemaPath = $schema;3798var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);3799out += ' ' + ($code) + ' ';3800if ($breakOnError) {3801out += ' if (' + ($nextValid) + ') { ';3802}3803} else {3804$async = $refVal.$async === true || (it.async && $refVal.$async !== false);3805$refCode = $refVal.code;3806}3807}3808if ($refCode) {3809var $$outStack = $$outStack || [];3810$$outStack.push(out);3811out = '';3812if (it.opts.passContext) {3813out += ' ' + ($refCode) + '.call(this, ';3814} else {3815out += ' ' + ($refCode) + '( ';3816}3817out += ' ' + ($data) + ', (dataPath || \'\')';3818if (it.errorPath != '""') {3819out += ' + ' + (it.errorPath);3820}3821var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',3822$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';3823out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';3824var __callValidate = out;3825out = $$outStack.pop();3826if ($async) {3827if (!it.async) throw new Error('async schema referenced by sync schema');3828if ($breakOnError) {3829out += ' var ' + ($valid) + '; ';3830}3831out += ' try { await ' + (__callValidate) + '; ';3832if ($breakOnError) {3833out += ' ' + ($valid) + ' = true; ';3834}3835out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ';3836if ($breakOnError) {3837out += ' ' + ($valid) + ' = false; ';3838}3839out += ' } ';3840if ($breakOnError) {3841out += ' if (' + ($valid) + ') { ';3842}3843} else {3844out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';3845if ($breakOnError) {3846out += ' else { ';3847}3848}3849}3850return out;3851}38523853},{}],36:[function(require,module,exports){3854'use strict';3855module.exports = function generate_required(it, $keyword, $ruleType) {3856var out = ' ';3857var $lvl = it.level;3858var $dataLvl = it.dataLevel;3859var $schema = it.schema[$keyword];3860var $schemaPath = it.schemaPath + it.util.getProperty($keyword);3861var $errSchemaPath = it.errSchemaPath + '/' + $keyword;3862var $breakOnError = !it.opts.allErrors;3863var $data = 'data' + ($dataLvl || '');3864var $valid = 'valid' + $lvl;3865var $isData = it.opts.$data && $schema && $schema.$data,3866$schemaValue;3867if ($isData) {3868out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';3869$schemaValue = 'schema' + $lvl;3870} else {3871$schemaValue = $schema;3872}3873var $vSchema = 'schema' + $lvl;3874if (!$isData) {3875if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {3876var $required = [];3877var arr1 = $schema;3878if (arr1) {3879var $property, i1 = -1,3880l1 = arr1.length - 1;3881while (i1 < l1) {3882$property = arr1[i1 += 1];3883var $propertySch = it.schema.properties[$property];3884if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {3885$required[$required.length] = $property;3886}3887}3888}3889} else {3890var $required = $schema;3891}3892}3893if ($isData || $required.length) {3894var $currentErrorPath = it.errorPath,3895$loopRequired = $isData || $required.length >= it.opts.loopRequired,3896$ownProperties = it.opts.ownProperties;3897if ($breakOnError) {3898out += ' var missing' + ($lvl) + '; ';3899if ($loopRequired) {3900if (!$isData) {3901out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';3902}3903var $i = 'i' + $lvl,3904$propertyPath = 'schema' + $lvl + '[' + $i + ']',3905$missingProperty = '\' + ' + $propertyPath + ' + \'';3906if (it.opts._errorDataPathProperty) {3907it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);3908}3909out += ' var ' + ($valid) + ' = true; ';3910if ($isData) {3911out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';3912}3913out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';3914if ($ownProperties) {3915out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';3916}3917out += '; if (!' + ($valid) + ') break; } ';3918if ($isData) {3919out += ' } ';3920}3921out += ' if (!' + ($valid) + ') { ';3922var $$outStack = $$outStack || [];3923$$outStack.push(out);3924out = ''; /* istanbul ignore else */3925if (it.createErrors !== false) {3926out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';3927if (it.opts.messages !== false) {3928out += ' , message: \'';3929if (it.opts._errorDataPathProperty) {3930out += 'is a required property';3931} else {3932out += 'should have required property \\\'' + ($missingProperty) + '\\\'';3933}3934out += '\' ';3935}3936if (it.opts.verbose) {3937out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3938}3939out += ' } ';3940} else {3941out += ' {} ';3942}3943var __err = out;3944out = $$outStack.pop();3945if (!it.compositeRule && $breakOnError) {3946/* istanbul ignore if */3947if (it.async) {3948out += ' throw new ValidationError([' + (__err) + ']); ';3949} else {3950out += ' validate.errors = [' + (__err) + ']; return false; ';3951}3952} else {3953out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';3954}3955out += ' } else { ';3956} else {3957out += ' if ( ';3958var arr2 = $required;3959if (arr2) {3960var $propertyKey, $i = -1,3961l2 = arr2.length - 1;3962while ($i < l2) {3963$propertyKey = arr2[$i += 1];3964if ($i) {3965out += ' || ';3966}3967var $prop = it.util.getProperty($propertyKey),3968$useData = $data + $prop;3969out += ' ( ( ' + ($useData) + ' === undefined ';3970if ($ownProperties) {3971out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';3972}3973out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';3974}3975}3976out += ') { ';3977var $propertyPath = 'missing' + $lvl,3978$missingProperty = '\' + ' + $propertyPath + ' + \'';3979if (it.opts._errorDataPathProperty) {3980it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;3981}3982var $$outStack = $$outStack || [];3983$$outStack.push(out);3984out = ''; /* istanbul ignore else */3985if (it.createErrors !== false) {3986out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';3987if (it.opts.messages !== false) {3988out += ' , message: \'';3989if (it.opts._errorDataPathProperty) {3990out += 'is a required property';3991} else {3992out += 'should have required property \\\'' + ($missingProperty) + '\\\'';3993}3994out += '\' ';3995}3996if (it.opts.verbose) {3997out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';3998}3999out += ' } ';4000} else {4001out += ' {} ';4002}4003var __err = out;4004out = $$outStack.pop();4005if (!it.compositeRule && $breakOnError) {4006/* istanbul ignore if */4007if (it.async) {4008out += ' throw new ValidationError([' + (__err) + ']); ';4009} else {4010out += ' validate.errors = [' + (__err) + ']; return false; ';4011}4012} else {4013out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';4014}4015out += ' } else { ';4016}4017} else {4018if ($loopRequired) {4019if (!$isData) {4020out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';4021}4022var $i = 'i' + $lvl,4023$propertyPath = 'schema' + $lvl + '[' + $i + ']',4024$missingProperty = '\' + ' + $propertyPath + ' + \'';4025if (it.opts._errorDataPathProperty) {4026it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);4027}4028if ($isData) {4029out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */4030if (it.createErrors !== false) {4031out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';4032if (it.opts.messages !== false) {4033out += ' , message: \'';4034if (it.opts._errorDataPathProperty) {4035out += 'is a required property';4036} else {4037out += 'should have required property \\\'' + ($missingProperty) + '\\\'';4038}4039out += '\' ';4040}4041if (it.opts.verbose) {4042out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4043}4044out += ' } ';4045} else {4046out += ' {} ';4047}4048out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';4049}4050out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';4051if ($ownProperties) {4052out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';4053}4054out += ') { var err = '; /* istanbul ignore else */4055if (it.createErrors !== false) {4056out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';4057if (it.opts.messages !== false) {4058out += ' , message: \'';4059if (it.opts._errorDataPathProperty) {4060out += 'is a required property';4061} else {4062out += 'should have required property \\\'' + ($missingProperty) + '\\\'';4063}4064out += '\' ';4065}4066if (it.opts.verbose) {4067out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4068}4069out += ' } ';4070} else {4071out += ' {} ';4072}4073out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';4074if ($isData) {4075out += ' } ';4076}4077} else {4078var arr3 = $required;4079if (arr3) {4080var $propertyKey, i3 = -1,4081l3 = arr3.length - 1;4082while (i3 < l3) {4083$propertyKey = arr3[i3 += 1];4084var $prop = it.util.getProperty($propertyKey),4085$missingProperty = it.util.escapeQuotes($propertyKey),4086$useData = $data + $prop;4087if (it.opts._errorDataPathProperty) {4088it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);4089}4090out += ' if ( ' + ($useData) + ' === undefined ';4091if ($ownProperties) {4092out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';4093}4094out += ') { var err = '; /* istanbul ignore else */4095if (it.createErrors !== false) {4096out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';4097if (it.opts.messages !== false) {4098out += ' , message: \'';4099if (it.opts._errorDataPathProperty) {4100out += 'is a required property';4101} else {4102out += 'should have required property \\\'' + ($missingProperty) + '\\\'';4103}4104out += '\' ';4105}4106if (it.opts.verbose) {4107out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4108}4109out += ' } ';4110} else {4111out += ' {} ';4112}4113out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';4114}4115}4116}4117}4118it.errorPath = $currentErrorPath;4119} else if ($breakOnError) {4120out += ' if (true) {';4121}4122return out;4123}41244125},{}],37:[function(require,module,exports){4126'use strict';4127module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {4128var out = ' ';4129var $lvl = it.level;4130var $dataLvl = it.dataLevel;4131var $schema = it.schema[$keyword];4132var $schemaPath = it.schemaPath + it.util.getProperty($keyword);4133var $errSchemaPath = it.errSchemaPath + '/' + $keyword;4134var $breakOnError = !it.opts.allErrors;4135var $data = 'data' + ($dataLvl || '');4136var $valid = 'valid' + $lvl;4137var $isData = it.opts.$data && $schema && $schema.$data,4138$schemaValue;4139if ($isData) {4140out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';4141$schemaValue = 'schema' + $lvl;4142} else {4143$schemaValue = $schema;4144}4145if (($schema || $isData) && it.opts.uniqueItems !== false) {4146if ($isData) {4147out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { ';4148}4149out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';4150var $itemType = it.schema.items && it.schema.items.type,4151$typeIsArray = Array.isArray($itemType);4152if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {4153out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';4154} else {4155out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';4156var $method = 'checkDataType' + ($typeIsArray ? 's' : '');4157out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';4158if ($typeIsArray) {4159out += ' if (typeof item == \'string\') item = \'"\' + item; ';4160}4161out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';4162}4163out += ' } ';4164if ($isData) {4165out += ' } ';4166}4167out += ' if (!' + ($valid) + ') { ';4168var $$outStack = $$outStack || [];4169$$outStack.push(out);4170out = ''; /* istanbul ignore else */4171if (it.createErrors !== false) {4172out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';4173if (it.opts.messages !== false) {4174out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' ';4175}4176if (it.opts.verbose) {4177out += ' , schema: ';4178if ($isData) {4179out += 'validate.schema' + ($schemaPath);4180} else {4181out += '' + ($schema);4182}4183out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4184}4185out += ' } ';4186} else {4187out += ' {} ';4188}4189var __err = out;4190out = $$outStack.pop();4191if (!it.compositeRule && $breakOnError) {4192/* istanbul ignore if */4193if (it.async) {4194out += ' throw new ValidationError([' + (__err) + ']); ';4195} else {4196out += ' validate.errors = [' + (__err) + ']; return false; ';4197}4198} else {4199out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';4200}4201out += ' } ';4202if ($breakOnError) {4203out += ' else { ';4204}4205} else {4206if ($breakOnError) {4207out += ' if (true) { ';4208}4209}4210return out;4211}42124213},{}],38:[function(require,module,exports){4214'use strict';4215module.exports = function generate_validate(it, $keyword, $ruleType) {4216var out = '';4217var $async = it.schema.$async === true,4218$refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),4219$id = it.self._getId(it.schema);4220if (it.opts.strictKeywords) {4221var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);4222if ($unknownKwd) {4223var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;4224if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);4225else throw new Error($keywordsMsg);4226}4227}4228if (it.isTop) {4229out += ' var validate = ';4230if ($async) {4231it.async = true;4232out += 'async ';4233}4234out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';4235if ($id && (it.opts.sourceCode || it.opts.processCode)) {4236out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' ';4237}4238}4239if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) {4240var $keyword = 'false schema';4241var $lvl = it.level;4242var $dataLvl = it.dataLevel;4243var $schema = it.schema[$keyword];4244var $schemaPath = it.schemaPath + it.util.getProperty($keyword);4245var $errSchemaPath = it.errSchemaPath + '/' + $keyword;4246var $breakOnError = !it.opts.allErrors;4247var $errorKeyword;4248var $data = 'data' + ($dataLvl || '');4249var $valid = 'valid' + $lvl;4250if (it.schema === false) {4251if (it.isTop) {4252$breakOnError = true;4253} else {4254out += ' var ' + ($valid) + ' = false; ';4255}4256var $$outStack = $$outStack || [];4257$$outStack.push(out);4258out = ''; /* istanbul ignore else */4259if (it.createErrors !== false) {4260out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';4261if (it.opts.messages !== false) {4262out += ' , message: \'boolean schema is false\' ';4263}4264if (it.opts.verbose) {4265out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4266}4267out += ' } ';4268} else {4269out += ' {} ';4270}4271var __err = out;4272out = $$outStack.pop();4273if (!it.compositeRule && $breakOnError) {4274/* istanbul ignore if */4275if (it.async) {4276out += ' throw new ValidationError([' + (__err) + ']); ';4277} else {4278out += ' validate.errors = [' + (__err) + ']; return false; ';4279}4280} else {4281out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';4282}4283} else {4284if (it.isTop) {4285if ($async) {4286out += ' return data; ';4287} else {4288out += ' validate.errors = null; return true; ';4289}4290} else {4291out += ' var ' + ($valid) + ' = true; ';4292}4293}4294if (it.isTop) {4295out += ' }; return validate; ';4296}4297return out;4298}4299if (it.isTop) {4300var $top = it.isTop,4301$lvl = it.level = 0,4302$dataLvl = it.dataLevel = 0,4303$data = 'data';4304it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));4305it.baseId = it.baseId || it.rootId;4306delete it.isTop;4307it.dataPathArr = [""];4308if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {4309var $defaultMsg = 'default is ignored in the schema root';4310if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);4311else throw new Error($defaultMsg);4312}4313out += ' var vErrors = null; ';4314out += ' var errors = 0; ';4315out += ' if (rootData === undefined) rootData = data; ';4316} else {4317var $lvl = it.level,4318$dataLvl = it.dataLevel,4319$data = 'data' + ($dataLvl || '');4320if ($id) it.baseId = it.resolve.url(it.baseId, $id);4321if ($async && !it.async) throw new Error('async schema in sync schema');4322out += ' var errs_' + ($lvl) + ' = errors;';4323}4324var $valid = 'valid' + $lvl,4325$breakOnError = !it.opts.allErrors,4326$closingBraces1 = '',4327$closingBraces2 = '';4328var $errorKeyword;4329var $typeSchema = it.schema.type,4330$typeIsArray = Array.isArray($typeSchema);4331if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {4332if ($typeIsArray) {4333if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null');4334} else if ($typeSchema != 'null') {4335$typeSchema = [$typeSchema, 'null'];4336$typeIsArray = true;4337}4338}4339if ($typeIsArray && $typeSchema.length == 1) {4340$typeSchema = $typeSchema[0];4341$typeIsArray = false;4342}4343if (it.schema.$ref && $refKeywords) {4344if (it.opts.extendRefs == 'fail') {4345throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)');4346} else if (it.opts.extendRefs !== true) {4347$refKeywords = false;4348it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');4349}4350}4351if (it.schema.$comment && it.opts.$comment) {4352out += ' ' + (it.RULES.all.$comment.code(it, '$comment'));4353}4354if ($typeSchema) {4355if (it.opts.coerceTypes) {4356var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);4357}4358var $rulesGroup = it.RULES.types[$typeSchema];4359if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) {4360var $schemaPath = it.schemaPath + '.type',4361$errSchemaPath = it.errSchemaPath + '/type';4362var $schemaPath = it.schemaPath + '.type',4363$errSchemaPath = it.errSchemaPath + '/type',4364$method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';4365out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';4366if ($coerceToTypes) {4367var $dataType = 'dataType' + $lvl,4368$coerced = 'coerced' + $lvl;4369out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';4370if (it.opts.coerceTypes == 'array') {4371out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';4372}4373out += ' if (' + ($coerced) + ' !== undefined) ; ';4374var arr1 = $coerceToTypes;4375if (arr1) {4376var $type, $i = -1,4377l1 = arr1.length - 1;4378while ($i < l1) {4379$type = arr1[$i += 1];4380if ($type == 'string') {4381out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';4382} else if ($type == 'number' || $type == 'integer') {4383out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';4384if ($type == 'integer') {4385out += ' && !(' + ($data) + ' % 1)';4386}4387out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';4388} else if ($type == 'boolean') {4389out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';4390} else if ($type == 'null') {4391out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';4392} else if (it.opts.coerceTypes == 'array' && $type == 'array') {4393out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';4394}4395}4396}4397out += ' else { ';4398var $$outStack = $$outStack || [];4399$$outStack.push(out);4400out = ''; /* istanbul ignore else */4401if (it.createErrors !== false) {4402out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';4403if ($typeIsArray) {4404out += '' + ($typeSchema.join(","));4405} else {4406out += '' + ($typeSchema);4407}4408out += '\' } ';4409if (it.opts.messages !== false) {4410out += ' , message: \'should be ';4411if ($typeIsArray) {4412out += '' + ($typeSchema.join(","));4413} else {4414out += '' + ($typeSchema);4415}4416out += '\' ';4417}4418if (it.opts.verbose) {4419out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4420}4421out += ' } ';4422} else {4423out += ' {} ';4424}4425var __err = out;4426out = $$outStack.pop();4427if (!it.compositeRule && $breakOnError) {4428/* istanbul ignore if */4429if (it.async) {4430out += ' throw new ValidationError([' + (__err) + ']); ';4431} else {4432out += ' validate.errors = [' + (__err) + ']; return false; ';4433}4434} else {4435out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';4436}4437out += ' } if (' + ($coerced) + ' !== undefined) { ';4438var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',4439$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';4440out += ' ' + ($data) + ' = ' + ($coerced) + '; ';4441if (!$dataLvl) {4442out += 'if (' + ($parentData) + ' !== undefined)';4443}4444out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } ';4445} else {4446var $$outStack = $$outStack || [];4447$$outStack.push(out);4448out = ''; /* istanbul ignore else */4449if (it.createErrors !== false) {4450out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';4451if ($typeIsArray) {4452out += '' + ($typeSchema.join(","));4453} else {4454out += '' + ($typeSchema);4455}4456out += '\' } ';4457if (it.opts.messages !== false) {4458out += ' , message: \'should be ';4459if ($typeIsArray) {4460out += '' + ($typeSchema.join(","));4461} else {4462out += '' + ($typeSchema);4463}4464out += '\' ';4465}4466if (it.opts.verbose) {4467out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4468}4469out += ' } ';4470} else {4471out += ' {} ';4472}4473var __err = out;4474out = $$outStack.pop();4475if (!it.compositeRule && $breakOnError) {4476/* istanbul ignore if */4477if (it.async) {4478out += ' throw new ValidationError([' + (__err) + ']); ';4479} else {4480out += ' validate.errors = [' + (__err) + ']; return false; ';4481}4482} else {4483out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';4484}4485}4486out += ' } ';4487}4488}4489if (it.schema.$ref && !$refKeywords) {4490out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' ';4491if ($breakOnError) {4492out += ' } if (errors === ';4493if ($top) {4494out += '0';4495} else {4496out += 'errs_' + ($lvl);4497}4498out += ') { ';4499$closingBraces2 += '}';4500}4501} else {4502var arr2 = it.RULES;4503if (arr2) {4504var $rulesGroup, i2 = -1,4505l2 = arr2.length - 1;4506while (i2 < l2) {4507$rulesGroup = arr2[i2 += 1];4508if ($shouldUseGroup($rulesGroup)) {4509if ($rulesGroup.type) {4510out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';4511}4512if (it.opts.useDefaults) {4513if ($rulesGroup.type == 'object' && it.schema.properties) {4514var $schema = it.schema.properties,4515$schemaKeys = Object.keys($schema);4516var arr3 = $schemaKeys;4517if (arr3) {4518var $propertyKey, i3 = -1,4519l3 = arr3.length - 1;4520while (i3 < l3) {4521$propertyKey = arr3[i3 += 1];4522var $sch = $schema[$propertyKey];4523if ($sch.default !== undefined) {4524var $passData = $data + it.util.getProperty($propertyKey);4525if (it.compositeRule) {4526if (it.opts.strictDefaults) {4527var $defaultMsg = 'default is ignored for: ' + $passData;4528if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);4529else throw new Error($defaultMsg);4530}4531} else {4532out += ' if (' + ($passData) + ' === undefined ';4533if (it.opts.useDefaults == 'empty') {4534out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';4535}4536out += ' ) ' + ($passData) + ' = ';4537if (it.opts.useDefaults == 'shared') {4538out += ' ' + (it.useDefault($sch.default)) + ' ';4539} else {4540out += ' ' + (JSON.stringify($sch.default)) + ' ';4541}4542out += '; ';4543}4544}4545}4546}4547} else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) {4548var arr4 = it.schema.items;4549if (arr4) {4550var $sch, $i = -1,4551l4 = arr4.length - 1;4552while ($i < l4) {4553$sch = arr4[$i += 1];4554if ($sch.default !== undefined) {4555var $passData = $data + '[' + $i + ']';4556if (it.compositeRule) {4557if (it.opts.strictDefaults) {4558var $defaultMsg = 'default is ignored for: ' + $passData;4559if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);4560else throw new Error($defaultMsg);4561}4562} else {4563out += ' if (' + ($passData) + ' === undefined ';4564if (it.opts.useDefaults == 'empty') {4565out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';4566}4567out += ' ) ' + ($passData) + ' = ';4568if (it.opts.useDefaults == 'shared') {4569out += ' ' + (it.useDefault($sch.default)) + ' ';4570} else {4571out += ' ' + (JSON.stringify($sch.default)) + ' ';4572}4573out += '; ';4574}4575}4576}4577}4578}4579}4580var arr5 = $rulesGroup.rules;4581if (arr5) {4582var $rule, i5 = -1,4583l5 = arr5.length - 1;4584while (i5 < l5) {4585$rule = arr5[i5 += 1];4586if ($shouldUseRule($rule)) {4587var $code = $rule.code(it, $rule.keyword, $rulesGroup.type);4588if ($code) {4589out += ' ' + ($code) + ' ';4590if ($breakOnError) {4591$closingBraces1 += '}';4592}4593}4594}4595}4596}4597if ($breakOnError) {4598out += ' ' + ($closingBraces1) + ' ';4599$closingBraces1 = '';4600}4601if ($rulesGroup.type) {4602out += ' } ';4603if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) {4604out += ' else { ';4605var $schemaPath = it.schemaPath + '.type',4606$errSchemaPath = it.errSchemaPath + '/type';4607var $$outStack = $$outStack || [];4608$$outStack.push(out);4609out = ''; /* istanbul ignore else */4610if (it.createErrors !== false) {4611out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';4612if ($typeIsArray) {4613out += '' + ($typeSchema.join(","));4614} else {4615out += '' + ($typeSchema);4616}4617out += '\' } ';4618if (it.opts.messages !== false) {4619out += ' , message: \'should be ';4620if ($typeIsArray) {4621out += '' + ($typeSchema.join(","));4622} else {4623out += '' + ($typeSchema);4624}4625out += '\' ';4626}4627if (it.opts.verbose) {4628out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';4629}4630out += ' } ';4631} else {4632out += ' {} ';4633}4634var __err = out;4635out = $$outStack.pop();4636if (!it.compositeRule && $breakOnError) {4637/* istanbul ignore if */4638if (it.async) {4639out += ' throw new ValidationError([' + (__err) + ']); ';4640} else {4641out += ' validate.errors = [' + (__err) + ']; return false; ';4642}4643} else {4644out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';4645}4646out += ' } ';4647}4648}4649if ($breakOnError) {4650out += ' if (errors === ';4651if ($top) {4652out += '0';4653} else {4654out += 'errs_' + ($lvl);4655}4656out += ') { ';4657$closingBraces2 += '}';4658}4659}4660}4661}4662}4663if ($breakOnError) {4664out += ' ' + ($closingBraces2) + ' ';4665}4666if ($top) {4667if ($async) {4668out += ' if (errors === 0) return data; ';4669out += ' else throw new ValidationError(vErrors); ';4670} else {4671out += ' validate.errors = vErrors; ';4672out += ' return errors === 0; ';4673}4674out += ' }; return validate;';4675} else {4676out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';4677}46784679function $shouldUseGroup($rulesGroup) {4680var rules = $rulesGroup.rules;4681for (var i = 0; i < rules.length; i++)4682if ($shouldUseRule(rules[i])) return true;4683}46844685function $shouldUseRule($rule) {4686return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule));4687}46884689function $ruleImplementsSomeKeyword($rule) {4690var impl = $rule.implements;4691for (var i = 0; i < impl.length; i++)4692if (it.schema[impl[i]] !== undefined) return true;4693}4694return out;4695}46964697},{}],39:[function(require,module,exports){4698'use strict';46994700var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;4701var customRuleCode = require('./dotjs/custom');4702var definitionSchema = require('./definition_schema');47034704module.exports = {4705add: addKeyword,4706get: getKeyword,4707remove: removeKeyword,4708validate: validateKeyword4709};471047114712/**4713* Define custom keyword4714* @this Ajv4715* @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).4716* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.4717* @return {Ajv} this for method chaining4718*/4719function addKeyword(keyword, definition) {4720/* jshint validthis: true */4721/* eslint no-shadow: 0 */4722var RULES = this.RULES;4723if (RULES.keywords[keyword])4724throw new Error('Keyword ' + keyword + ' is already defined');47254726if (!IDENTIFIER.test(keyword))4727throw new Error('Keyword ' + keyword + ' is not a valid identifier');47284729if (definition) {4730this.validateKeyword(definition, true);47314732var dataType = definition.type;4733if (Array.isArray(dataType)) {4734for (var i=0; i<dataType.length; i++)4735_addRule(keyword, dataType[i], definition);4736} else {4737_addRule(keyword, dataType, definition);4738}47394740var metaSchema = definition.metaSchema;4741if (metaSchema) {4742if (definition.$data && this._opts.$data) {4743metaSchema = {4744anyOf: [4745metaSchema,4746{ '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }4747]4748};4749}4750definition.validateSchema = this.compile(metaSchema, true);4751}4752}47534754RULES.keywords[keyword] = RULES.all[keyword] = true;475547564757function _addRule(keyword, dataType, definition) {4758var ruleGroup;4759for (var i=0; i<RULES.length; i++) {4760var rg = RULES[i];4761if (rg.type == dataType) {4762ruleGroup = rg;4763break;4764}4765}47664767if (!ruleGroup) {4768ruleGroup = { type: dataType, rules: [] };4769RULES.push(ruleGroup);4770}47714772var rule = {4773keyword: keyword,4774definition: definition,4775custom: true,4776code: customRuleCode,4777implements: definition.implements4778};4779ruleGroup.rules.push(rule);4780RULES.custom[keyword] = rule;4781}47824783return this;4784}478547864787/**4788* Get keyword4789* @this Ajv4790* @param {String} keyword pre-defined or custom keyword.4791* @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.4792*/4793function getKeyword(keyword) {4794/* jshint validthis: true */4795var rule = this.RULES.custom[keyword];4796return rule ? rule.definition : this.RULES.keywords[keyword] || false;4797}479847994800/**4801* Remove keyword4802* @this Ajv4803* @param {String} keyword pre-defined or custom keyword.4804* @return {Ajv} this for method chaining4805*/4806function removeKeyword(keyword) {4807/* jshint validthis: true */4808var RULES = this.RULES;4809delete RULES.keywords[keyword];4810delete RULES.all[keyword];4811delete RULES.custom[keyword];4812for (var i=0; i<RULES.length; i++) {4813var rules = RULES[i].rules;4814for (var j=0; j<rules.length; j++) {4815if (rules[j].keyword == keyword) {4816rules.splice(j, 1);4817break;4818}4819}4820}4821return this;4822}482348244825/**4826* Validate keyword definition4827* @this Ajv4828* @param {Object} definition keyword definition object.4829* @param {Boolean} throwError true to throw exception if definition is invalid4830* @return {boolean} validation result4831*/4832function validateKeyword(definition, throwError) {4833validateKeyword.errors = null;4834var v = this._validateKeyword = this._validateKeyword4835|| this.compile(definitionSchema, true);48364837if (v(definition)) return true;4838validateKeyword.errors = v.errors;4839if (throwError)4840throw new Error('custom keyword definition is invalid: ' + this.errorsText(v.errors));4841else4842return false;4843}48444845},{"./definition_schema":12,"./dotjs/custom":22}],40:[function(require,module,exports){4846module.exports={4847"$schema": "http://json-schema.org/draft-07/schema#",4848"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",4849"description": "Meta-schema for $data reference (JSON Schema extension proposal)",4850"type": "object",4851"required": [ "$data" ],4852"properties": {4853"$data": {4854"type": "string",4855"anyOf": [4856{ "format": "relative-json-pointer" },4857{ "format": "json-pointer" }4858]4859}4860},4861"additionalProperties": false4862}48634864},{}],41:[function(require,module,exports){4865module.exports={4866"$schema": "http://json-schema.org/draft-07/schema#",4867"$id": "http://json-schema.org/draft-07/schema#",4868"title": "Core schema meta-schema",4869"definitions": {4870"schemaArray": {4871"type": "array",4872"minItems": 1,4873"items": { "$ref": "#" }4874},4875"nonNegativeInteger": {4876"type": "integer",4877"minimum": 04878},4879"nonNegativeIntegerDefault0": {4880"allOf": [4881{ "$ref": "#/definitions/nonNegativeInteger" },4882{ "default": 0 }4883]4884},4885"simpleTypes": {4886"enum": [4887"array",4888"boolean",4889"integer",4890"null",4891"number",4892"object",4893"string"4894]4895},4896"stringArray": {4897"type": "array",4898"items": { "type": "string" },4899"uniqueItems": true,4900"default": []4901}4902},4903"type": ["object", "boolean"],4904"properties": {4905"$id": {4906"type": "string",4907"format": "uri-reference"4908},4909"$schema": {4910"type": "string",4911"format": "uri"4912},4913"$ref": {4914"type": "string",4915"format": "uri-reference"4916},4917"$comment": {4918"type": "string"4919},4920"title": {4921"type": "string"4922},4923"description": {4924"type": "string"4925},4926"default": true,4927"readOnly": {4928"type": "boolean",4929"default": false4930},4931"examples": {4932"type": "array",4933"items": true4934},4935"multipleOf": {4936"type": "number",4937"exclusiveMinimum": 04938},4939"maximum": {4940"type": "number"4941},4942"exclusiveMaximum": {4943"type": "number"4944},4945"minimum": {4946"type": "number"4947},4948"exclusiveMinimum": {4949"type": "number"4950},4951"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },4952"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },4953"pattern": {4954"type": "string",4955"format": "regex"4956},4957"additionalItems": { "$ref": "#" },4958"items": {4959"anyOf": [4960{ "$ref": "#" },4961{ "$ref": "#/definitions/schemaArray" }4962],4963"default": true4964},4965"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },4966"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },4967"uniqueItems": {4968"type": "boolean",4969"default": false4970},4971"contains": { "$ref": "#" },4972"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },4973"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },4974"required": { "$ref": "#/definitions/stringArray" },4975"additionalProperties": { "$ref": "#" },4976"definitions": {4977"type": "object",4978"additionalProperties": { "$ref": "#" },4979"default": {}4980},4981"properties": {4982"type": "object",4983"additionalProperties": { "$ref": "#" },4984"default": {}4985},4986"patternProperties": {4987"type": "object",4988"additionalProperties": { "$ref": "#" },4989"propertyNames": { "format": "regex" },4990"default": {}4991},4992"dependencies": {4993"type": "object",4994"additionalProperties": {4995"anyOf": [4996{ "$ref": "#" },4997{ "$ref": "#/definitions/stringArray" }4998]4999}5000},5001"propertyNames": { "$ref": "#" },5002"const": true,5003"enum": {5004"type": "array",5005"items": true,5006"minItems": 1,5007"uniqueItems": true5008},5009"type": {5010"anyOf": [5011{ "$ref": "#/definitions/simpleTypes" },5012{5013"type": "array",5014"items": { "$ref": "#/definitions/simpleTypes" },5015"minItems": 1,5016"uniqueItems": true5017}5018]5019},5020"format": { "type": "string" },5021"contentMediaType": { "type": "string" },5022"contentEncoding": { "type": "string" },5023"if": {"$ref": "#"},5024"then": {"$ref": "#"},5025"else": {"$ref": "#"},5026"allOf": { "$ref": "#/definitions/schemaArray" },5027"anyOf": { "$ref": "#/definitions/schemaArray" },5028"oneOf": { "$ref": "#/definitions/schemaArray" },5029"not": { "$ref": "#" }5030},5031"default": true5032}50335034},{}],42:[function(require,module,exports){5035'use strict';50365037// do not edit .js files directly - edit src/index.jst5038503950405041module.exports = function equal(a, b) {5042if (a === b) return true;50435044if (a && b && typeof a == 'object' && typeof b == 'object') {5045if (a.constructor !== b.constructor) return false;50465047var length, i, keys;5048if (Array.isArray(a)) {5049length = a.length;5050if (length != b.length) return false;5051for (i = length; i-- !== 0;)5052if (!equal(a[i], b[i])) return false;5053return true;5054}5055505650575058if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;5059if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();5060if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();50615062keys = Object.keys(a);5063length = keys.length;5064if (length !== Object.keys(b).length) return false;50655066for (i = length; i-- !== 0;)5067if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;50685069for (i = length; i-- !== 0;) {5070var key = keys[i];50715072if (!equal(a[key], b[key])) return false;5073}50745075return true;5076}50775078// true if both NaN, false otherwise5079return a!==a && b!==b;5080};50815082},{}],43:[function(require,module,exports){5083'use strict';50845085module.exports = function (data, opts) {5086if (!opts) opts = {};5087if (typeof opts === 'function') opts = { cmp: opts };5088var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;50895090var cmp = opts.cmp && (function (f) {5091return function (node) {5092return function (a, b) {5093var aobj = { key: a, value: node[a] };5094var bobj = { key: b, value: node[b] };5095return f(aobj, bobj);5096};5097};5098})(opts.cmp);50995100var seen = [];5101return (function stringify (node) {5102if (node && node.toJSON && typeof node.toJSON === 'function') {5103node = node.toJSON();5104}51055106if (node === undefined) return;5107if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';5108if (typeof node !== 'object') return JSON.stringify(node);51095110var i, out;5111if (Array.isArray(node)) {5112out = '[';5113for (i = 0; i < node.length; i++) {5114if (i) out += ',';5115out += stringify(node[i]) || 'null';5116}5117return out + ']';5118}51195120if (node === null) return 'null';51215122if (seen.indexOf(node) !== -1) {5123if (cycles) return JSON.stringify('__cycle__');5124throw new TypeError('Converting circular structure to JSON');5125}51265127var seenIndex = seen.push(node) - 1;5128var keys = Object.keys(node).sort(cmp && cmp(node));5129out = '';5130for (i = 0; i < keys.length; i++) {5131var key = keys[i];5132var value = stringify(node[key]);51335134if (!value) continue;5135if (out) out += ',';5136out += JSON.stringify(key) + ':' + value;5137}5138seen.splice(seenIndex, 1);5139return '{' + out + '}';5140})(data);5141};51425143},{}],44:[function(require,module,exports){5144'use strict';51455146var traverse = module.exports = function (schema, opts, cb) {5147// Legacy support for v0.3.1 and earlier.5148if (typeof opts == 'function') {5149cb = opts;5150opts = {};5151}51525153cb = opts.cb || cb;5154var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};5155var post = cb.post || function() {};51565157_traverse(opts, pre, post, schema, '', schema);5158};515951605161traverse.keywords = {5162additionalItems: true,5163items: true,5164contains: true,5165additionalProperties: true,5166propertyNames: true,5167not: true5168};51695170traverse.arrayKeywords = {5171items: true,5172allOf: true,5173anyOf: true,5174oneOf: true5175};51765177traverse.propsKeywords = {5178definitions: true,5179properties: true,5180patternProperties: true,5181dependencies: true5182};51835184traverse.skipKeywords = {5185default: true,5186enum: true,5187const: true,5188required: true,5189maximum: true,5190minimum: true,5191exclusiveMaximum: true,5192exclusiveMinimum: true,5193multipleOf: true,5194maxLength: true,5195minLength: true,5196pattern: true,5197format: true,5198maxItems: true,5199minItems: true,5200uniqueItems: true,5201maxProperties: true,5202minProperties: true5203};520452055206function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {5207if (schema && typeof schema == 'object' && !Array.isArray(schema)) {5208pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);5209for (var key in schema) {5210var sch = schema[key];5211if (Array.isArray(sch)) {5212if (key in traverse.arrayKeywords) {5213for (var i=0; i<sch.length; i++)5214_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);5215}5216} else if (key in traverse.propsKeywords) {5217if (sch && typeof sch == 'object') {5218for (var prop in sch)5219_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);5220}5221} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {5222_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);5223}5224}5225post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);5226}5227}522852295230function escapeJsonPtr(str) {5231return str.replace(/~/g, '~0').replace(/\//g, '~1');5232}52335234},{}],45:[function(require,module,exports){5235/** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */5236(function (global, factory) {5237typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :5238typeof define === 'function' && define.amd ? define(['exports'], factory) :5239(factory((global.URI = global.URI || {})));5240}(this, (function (exports) { 'use strict';52415242function merge() {5243for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {5244sets[_key] = arguments[_key];5245}52465247if (sets.length > 1) {5248sets[0] = sets[0].slice(0, -1);5249var xl = sets.length - 1;5250for (var x = 1; x < xl; ++x) {5251sets[x] = sets[x].slice(1, -1);5252}5253sets[xl] = sets[xl].slice(1);5254return sets.join('');5255} else {5256return sets[0];5257}5258}5259function subexp(str) {5260return "(?:" + str + ")";5261}5262function typeOf(o) {5263return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();5264}5265function toUpperCase(str) {5266return str.toUpperCase();5267}5268function toArray(obj) {5269return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];5270}5271function assign(target, source) {5272var obj = target;5273if (source) {5274for (var key in source) {5275obj[key] = source[key];5276}5277}5278return obj;5279}52805281function buildExps(isIRI) {5282var ALPHA$$ = "[A-Za-z]",5283CR$ = "[\\x0D]",5284DIGIT$$ = "[0-9]",5285DQUOTE$$ = "[\\x22]",5286HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),5287//case-insensitive5288LF$$ = "[\\x0A]",5289SP$$ = "[\\x20]",5290PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),5291//expanded5292GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",5293SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",5294RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),5295UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",5296//subset, excludes bidi control characters5297IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",5298//subset5299UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$),5300SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"),5301USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"),5302DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$),5303DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),5304//relaxed parsing rules5305IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),5306H16$ = subexp(HEXDIG$$ + "{1,4}"),5307LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),5308IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),5309// 6( h16 ":" ) ls325310IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),5311// "::" 5( h16 ":" ) ls325312IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),5313//[ h16 ] "::" 4( h16 ":" ) ls325314IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),5315//[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls325316IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),5317//[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls325318IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),5319//[ *3( h16 ":" ) h16 ] "::" h16 ":" ls325320IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),5321//[ *4( h16 ":" ) h16 ] "::" ls325322IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),5323//[ *5( h16 ":" ) h16 ] "::" h165324IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),5325//[ *6( h16 ":" ) h16 ] "::"5326IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),5327ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"),5328//RFC 68745329IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$),5330//RFC 68745331IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$),5332//RFC 6874, with relaxed parsing rules5333IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"),5334IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"),5335//RFC 68745336REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"),5337HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$),5338PORT$ = subexp(DIGIT$$ + "*"),5339AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"),5340PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")),5341SEGMENT$ = subexp(PCHAR$ + "*"),5342SEGMENT_NZ$ = subexp(PCHAR$ + "+"),5343SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"),5344PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"),5345PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"),5346//simplified5347PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$),5348//simplified5349PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$),5350//simplified5351PATH_EMPTY$ = "(?!" + PCHAR$ + ")",5352PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),5353QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"),5354FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"),5355HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),5356URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),5357RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$),5358RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),5359URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$),5360ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"),5361GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",5362RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",5363ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$",5364SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",5365AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$";5366return {5367NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),5368NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),5369NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),5370NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),5371NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),5372NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),5373NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),5374ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),5375UNRESERVED: new RegExp(UNRESERVED$$, "g"),5376OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),5377PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),5378IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),5379IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules5380};5381}5382var URI_PROTOCOL = buildExps(false);53835384var IRI_PROTOCOL = buildExps(true);53855386var slicedToArray = function () {5387function sliceIterator(arr, i) {5388var _arr = [];5389var _n = true;5390var _d = false;5391var _e = undefined;53925393try {5394for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {5395_arr.push(_s.value);53965397if (i && _arr.length === i) break;5398}5399} catch (err) {5400_d = true;5401_e = err;5402} finally {5403try {5404if (!_n && _i["return"]) _i["return"]();5405} finally {5406if (_d) throw _e;5407}5408}54095410return _arr;5411}54125413return function (arr, i) {5414if (Array.isArray(arr)) {5415return arr;5416} else if (Symbol.iterator in Object(arr)) {5417return sliceIterator(arr, i);5418} else {5419throw new TypeError("Invalid attempt to destructure non-iterable instance");5420}5421};5422}();54235424542554265427542854295430543154325433543454355436var toConsumableArray = function (arr) {5437if (Array.isArray(arr)) {5438for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];54395440return arr2;5441} else {5442return Array.from(arr);5443}5444};54455446/** Highest positive signed 32-bit float value */54475448var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-154495450/** Bootstring parameters */5451var base = 36;5452var tMin = 1;5453var tMax = 26;5454var skew = 38;5455var damp = 700;5456var initialBias = 72;5457var initialN = 128; // 0x805458var delimiter = '-'; // '\x2D'54595460/** Regular expressions */5461var regexPunycode = /^xn--/;5462var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars5463var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators54645465/** Error messages */5466var errors = {5467'overflow': 'Overflow: input needs wider integers to process',5468'not-basic': 'Illegal input >= 0x80 (not a basic code point)',5469'invalid-input': 'Invalid input'5470};54715472/** Convenience shortcuts */5473var baseMinusTMin = base - tMin;5474var floor = Math.floor;5475var stringFromCharCode = String.fromCharCode;54765477/*--------------------------------------------------------------------------*/54785479/**5480* A generic error utility function.5481* @private5482* @param {String} type The error type.5483* @returns {Error} Throws a `RangeError` with the applicable error message.5484*/5485function error$1(type) {5486throw new RangeError(errors[type]);5487}54885489/**5490* A generic `Array#map` utility function.5491* @private5492* @param {Array} array The array to iterate over.5493* @param {Function} callback The function that gets called for every array5494* item.5495* @returns {Array} A new array of values returned by the callback function.5496*/5497function map(array, fn) {5498var result = [];5499var length = array.length;5500while (length--) {5501result[length] = fn(array[length]);5502}5503return result;5504}55055506/**5507* A simple `Array#map`-like wrapper to work with domain name strings or email5508* addresses.5509* @private5510* @param {String} domain The domain name or email address.5511* @param {Function} callback The function that gets called for every5512* character.5513* @returns {Array} A new string of characters returned by the callback5514* function.5515*/5516function mapDomain(string, fn) {5517var parts = string.split('@');5518var result = '';5519if (parts.length > 1) {5520// In email addresses, only the domain name should be punycoded. Leave5521// the local part (i.e. everything up to `@`) intact.5522result = parts[0] + '@';5523string = parts[1];5524}5525// Avoid `split(regex)` for IE8 compatibility. See #17.5526string = string.replace(regexSeparators, '\x2E');5527var labels = string.split('.');5528var encoded = map(labels, fn).join('.');5529return result + encoded;5530}55315532/**5533* Creates an array containing the numeric code points of each Unicode5534* character in the string. While JavaScript uses UCS-2 internally,5535* this function will convert a pair of surrogate halves (each of which5536* UCS-2 exposes as separate characters) into a single code point,5537* matching UTF-16.5538* @see `punycode.ucs2.encode`5539* @see <https://mathiasbynens.be/notes/javascript-encoding>5540* @memberOf punycode.ucs25541* @name decode5542* @param {String} string The Unicode input string (UCS-2).5543* @returns {Array} The new array of code points.5544*/5545function ucs2decode(string) {5546var output = [];5547var counter = 0;5548var length = string.length;5549while (counter < length) {5550var value = string.charCodeAt(counter++);5551if (value >= 0xD800 && value <= 0xDBFF && counter < length) {5552// It's a high surrogate, and there is a next character.5553var extra = string.charCodeAt(counter++);5554if ((extra & 0xFC00) == 0xDC00) {5555// Low surrogate.5556output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);5557} else {5558// It's an unmatched surrogate; only append this code unit, in case the5559// next code unit is the high surrogate of a surrogate pair.5560output.push(value);5561counter--;5562}5563} else {5564output.push(value);5565}5566}5567return output;5568}55695570/**5571* Creates a string based on an array of numeric code points.5572* @see `punycode.ucs2.decode`5573* @memberOf punycode.ucs25574* @name encode5575* @param {Array} codePoints The array of numeric code points.5576* @returns {String} The new Unicode string (UCS-2).5577*/5578var ucs2encode = function ucs2encode(array) {5579return String.fromCodePoint.apply(String, toConsumableArray(array));5580};55815582/**5583* Converts a basic code point into a digit/integer.5584* @see `digitToBasic()`5585* @private5586* @param {Number} codePoint The basic numeric code point value.5587* @returns {Number} The numeric value of a basic code point (for use in5588* representing integers) in the range `0` to `base - 1`, or `base` if5589* the code point does not represent a value.5590*/5591var basicToDigit = function basicToDigit(codePoint) {5592if (codePoint - 0x30 < 0x0A) {5593return codePoint - 0x16;5594}5595if (codePoint - 0x41 < 0x1A) {5596return codePoint - 0x41;5597}5598if (codePoint - 0x61 < 0x1A) {5599return codePoint - 0x61;5600}5601return base;5602};56035604/**5605* Converts a digit/integer into a basic code point.5606* @see `basicToDigit()`5607* @private5608* @param {Number} digit The numeric value of a basic code point.5609* @returns {Number} The basic code point whose value (when used for5610* representing integers) is `digit`, which needs to be in the range5611* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is5612* used; else, the lowercase form is used. The behavior is undefined5613* if `flag` is non-zero and `digit` has no uppercase form.5614*/5615var digitToBasic = function digitToBasic(digit, flag) {5616// 0..25 map to ASCII a..z or A..Z5617// 26..35 map to ASCII 0..95618return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);5619};56205621/**5622* Bias adaptation function as per section 3.4 of RFC 3492.5623* https://tools.ietf.org/html/rfc3492#section-3.45624* @private5625*/5626var adapt = function adapt(delta, numPoints, firstTime) {5627var k = 0;5628delta = firstTime ? floor(delta / damp) : delta >> 1;5629delta += floor(delta / numPoints);5630for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {5631delta = floor(delta / baseMinusTMin);5632}5633return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));5634};56355636/**5637* Converts a Punycode string of ASCII-only symbols to a string of Unicode5638* symbols.5639* @memberOf punycode5640* @param {String} input The Punycode string of ASCII-only symbols.5641* @returns {String} The resulting string of Unicode symbols.5642*/5643var decode = function decode(input) {5644// Don't use UCS-2.5645var output = [];5646var inputLength = input.length;5647var i = 0;5648var n = initialN;5649var bias = initialBias;56505651// Handle the basic code points: let `basic` be the number of input code5652// points before the last delimiter, or `0` if there is none, then copy5653// the first basic code points to the output.56545655var basic = input.lastIndexOf(delimiter);5656if (basic < 0) {5657basic = 0;5658}56595660for (var j = 0; j < basic; ++j) {5661// if it's not a basic code point5662if (input.charCodeAt(j) >= 0x80) {5663error$1('not-basic');5664}5665output.push(input.charCodeAt(j));5666}56675668// Main decoding loop: start just after the last delimiter if any basic code5669// points were copied; start at the beginning otherwise.56705671for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{56725673// `index` is the index of the next character to be consumed.5674// Decode a generalized variable-length integer into `delta`,5675// which gets added to `i`. The overflow checking is easier5676// if we increase `i` as we go, then subtract off its starting5677// value at the end to obtain `delta`.5678var oldi = i;5679for (var w = 1, k = base;; /* no condition */k += base) {56805681if (index >= inputLength) {5682error$1('invalid-input');5683}56845685var digit = basicToDigit(input.charCodeAt(index++));56865687if (digit >= base || digit > floor((maxInt - i) / w)) {5688error$1('overflow');5689}56905691i += digit * w;5692var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;56935694if (digit < t) {5695break;5696}56975698var baseMinusT = base - t;5699if (w > floor(maxInt / baseMinusT)) {5700error$1('overflow');5701}57025703w *= baseMinusT;5704}57055706var out = output.length + 1;5707bias = adapt(i - oldi, out, oldi == 0);57085709// `i` was supposed to wrap around from `out` to `0`,5710// incrementing `n` each time, so we'll fix that now:5711if (floor(i / out) > maxInt - n) {5712error$1('overflow');5713}57145715n += floor(i / out);5716i %= out;57175718// Insert `n` at position `i` of the output.5719output.splice(i++, 0, n);5720}57215722return String.fromCodePoint.apply(String, output);5723};57245725/**5726* Converts a string of Unicode symbols (e.g. a domain name label) to a5727* Punycode string of ASCII-only symbols.5728* @memberOf punycode5729* @param {String} input The string of Unicode symbols.5730* @returns {String} The resulting Punycode string of ASCII-only symbols.5731*/5732var encode = function encode(input) {5733var output = [];57345735// Convert the input in UCS-2 to an array of Unicode code points.5736input = ucs2decode(input);57375738// Cache the length.5739var inputLength = input.length;57405741// Initialize the state.5742var n = initialN;5743var delta = 0;5744var bias = initialBias;57455746// Handle the basic code points.5747var _iteratorNormalCompletion = true;5748var _didIteratorError = false;5749var _iteratorError = undefined;57505751try {5752for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {5753var _currentValue2 = _step.value;57545755if (_currentValue2 < 0x80) {5756output.push(stringFromCharCode(_currentValue2));5757}5758}5759} catch (err) {5760_didIteratorError = true;5761_iteratorError = err;5762} finally {5763try {5764if (!_iteratorNormalCompletion && _iterator.return) {5765_iterator.return();5766}5767} finally {5768if (_didIteratorError) {5769throw _iteratorError;5770}5771}5772}57735774var basicLength = output.length;5775var handledCPCount = basicLength;57765777// `handledCPCount` is the number of code points that have been handled;5778// `basicLength` is the number of basic code points.57795780// Finish the basic string with a delimiter unless it's empty.5781if (basicLength) {5782output.push(delimiter);5783}57845785// Main encoding loop:5786while (handledCPCount < inputLength) {57875788// All non-basic code points < n have been handled already. Find the next5789// larger one:5790var m = maxInt;5791var _iteratorNormalCompletion2 = true;5792var _didIteratorError2 = false;5793var _iteratorError2 = undefined;57945795try {5796for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {5797var currentValue = _step2.value;57985799if (currentValue >= n && currentValue < m) {5800m = currentValue;5801}5802}58035804// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,5805// but guard against overflow.5806} catch (err) {5807_didIteratorError2 = true;5808_iteratorError2 = err;5809} finally {5810try {5811if (!_iteratorNormalCompletion2 && _iterator2.return) {5812_iterator2.return();5813}5814} finally {5815if (_didIteratorError2) {5816throw _iteratorError2;5817}5818}5819}58205821var handledCPCountPlusOne = handledCPCount + 1;5822if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {5823error$1('overflow');5824}58255826delta += (m - n) * handledCPCountPlusOne;5827n = m;58285829var _iteratorNormalCompletion3 = true;5830var _didIteratorError3 = false;5831var _iteratorError3 = undefined;58325833try {5834for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {5835var _currentValue = _step3.value;58365837if (_currentValue < n && ++delta > maxInt) {5838error$1('overflow');5839}5840if (_currentValue == n) {5841// Represent delta as a generalized variable-length integer.5842var q = delta;5843for (var k = base;; /* no condition */k += base) {5844var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;5845if (q < t) {5846break;5847}5848var qMinusT = q - t;5849var baseMinusT = base - t;5850output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));5851q = floor(qMinusT / baseMinusT);5852}58535854output.push(stringFromCharCode(digitToBasic(q, 0)));5855bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);5856delta = 0;5857++handledCPCount;5858}5859}5860} catch (err) {5861_didIteratorError3 = true;5862_iteratorError3 = err;5863} finally {5864try {5865if (!_iteratorNormalCompletion3 && _iterator3.return) {5866_iterator3.return();5867}5868} finally {5869if (_didIteratorError3) {5870throw _iteratorError3;5871}5872}5873}58745875++delta;5876++n;5877}5878return output.join('');5879};58805881/**5882* Converts a Punycode string representing a domain name or an email address5883* to Unicode. Only the Punycoded parts of the input will be converted, i.e.5884* it doesn't matter if you call it on a string that has already been5885* converted to Unicode.5886* @memberOf punycode5887* @param {String} input The Punycoded domain name or email address to5888* convert to Unicode.5889* @returns {String} The Unicode representation of the given Punycode5890* string.5891*/5892var toUnicode = function toUnicode(input) {5893return mapDomain(input, function (string) {5894return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;5895});5896};58975898/**5899* Converts a Unicode string representing a domain name or an email address to5900* Punycode. Only the non-ASCII parts of the domain name will be converted,5901* i.e. it doesn't matter if you call it with a domain that's already in5902* ASCII.5903* @memberOf punycode5904* @param {String} input The domain name or email address to convert, as a5905* Unicode string.5906* @returns {String} The Punycode representation of the given domain name or5907* email address.5908*/5909var toASCII = function toASCII(input) {5910return mapDomain(input, function (string) {5911return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;5912});5913};59145915/*--------------------------------------------------------------------------*/59165917/** Define the public API */5918var punycode = {5919/**5920* A string representing the current Punycode.js version number.5921* @memberOf punycode5922* @type String5923*/5924'version': '2.1.0',5925/**5926* An object of methods to convert from JavaScript's internal character5927* representation (UCS-2) to Unicode code points, and back.5928* @see <https://mathiasbynens.be/notes/javascript-encoding>5929* @memberOf punycode5930* @type Object5931*/5932'ucs2': {5933'decode': ucs2decode,5934'encode': ucs2encode5935},5936'decode': decode,5937'encode': encode,5938'toASCII': toASCII,5939'toUnicode': toUnicode5940};59415942/**5943* URI.js5944*5945* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.5946* @author <a href="mailto:[email protected]">Gary Court</a>5947* @see http://github.com/garycourt/uri-js5948*/5949/**5950* Copyright 2011 Gary Court. All rights reserved.5951*5952* Redistribution and use in source and binary forms, with or without modification, are5953* permitted provided that the following conditions are met:5954*5955* 1. Redistributions of source code must retain the above copyright notice, this list of5956* conditions and the following disclaimer.5957*5958* 2. Redistributions in binary form must reproduce the above copyright notice, this list5959* of conditions and the following disclaimer in the documentation and/or other materials5960* provided with the distribution.5961*5962* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED5963* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND5964* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR5965* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR5966* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR5967* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON5968* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING5969* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF5970* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.5971*5972* The views and conclusions contained in the software and documentation are those of the5973* authors and should not be interpreted as representing official policies, either expressed5974* or implied, of Gary Court.5975*/5976var SCHEMES = {};5977function pctEncChar(chr) {5978var c = chr.charCodeAt(0);5979var e = void 0;5980if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();5981return e;5982}5983function pctDecChars(str) {5984var newStr = "";5985var i = 0;5986var il = str.length;5987while (i < il) {5988var c = parseInt(str.substr(i + 1, 2), 16);5989if (c < 128) {5990newStr += String.fromCharCode(c);5991i += 3;5992} else if (c >= 194 && c < 224) {5993if (il - i >= 6) {5994var c2 = parseInt(str.substr(i + 4, 2), 16);5995newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);5996} else {5997newStr += str.substr(i, 6);5998}5999i += 6;6000} else if (c >= 224) {6001if (il - i >= 9) {6002var _c = parseInt(str.substr(i + 4, 2), 16);6003var c3 = parseInt(str.substr(i + 7, 2), 16);6004newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);6005} else {6006newStr += str.substr(i, 9);6007}6008i += 9;6009} else {6010newStr += str.substr(i, 3);6011i += 3;6012}6013}6014return newStr;6015}6016function _normalizeComponentEncoding(components, protocol) {6017function decodeUnreserved(str) {6018var decStr = pctDecChars(str);6019return !decStr.match(protocol.UNRESERVED) ? str : decStr;6020}6021if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");6022if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);6023if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);6024if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);6025if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);6026if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);6027return components;6028}60296030function _stripLeadingZeros(str) {6031return str.replace(/^0*(.*)/, "$1") || "0";6032}6033function _normalizeIPv4(host, protocol) {6034var matches = host.match(protocol.IPV4ADDRESS) || [];60356036var _matches = slicedToArray(matches, 2),6037address = _matches[1];60386039if (address) {6040return address.split(".").map(_stripLeadingZeros).join(".");6041} else {6042return host;6043}6044}6045function _normalizeIPv6(host, protocol) {6046var matches = host.match(protocol.IPV6ADDRESS) || [];60476048var _matches2 = slicedToArray(matches, 3),6049address = _matches2[1],6050zone = _matches2[2];60516052if (address) {6053var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),6054_address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),6055last = _address$toLowerCase$2[0],6056first = _address$toLowerCase$2[1];60576058var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];6059var lastFields = last.split(":").map(_stripLeadingZeros);6060var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);6061var fieldCount = isLastFieldIPv4Address ? 7 : 8;6062var lastFieldsStart = lastFields.length - fieldCount;6063var fields = Array(fieldCount);6064for (var x = 0; x < fieldCount; ++x) {6065fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';6066}6067if (isLastFieldIPv4Address) {6068fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);6069}6070var allZeroFields = fields.reduce(function (acc, field, index) {6071if (!field || field === "0") {6072var lastLongest = acc[acc.length - 1];6073if (lastLongest && lastLongest.index + lastLongest.length === index) {6074lastLongest.length++;6075} else {6076acc.push({ index: index, length: 1 });6077}6078}6079return acc;6080}, []);6081var longestZeroFields = allZeroFields.sort(function (a, b) {6082return b.length - a.length;6083})[0];6084var newHost = void 0;6085if (longestZeroFields && longestZeroFields.length > 1) {6086var newFirst = fields.slice(0, longestZeroFields.index);6087var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);6088newHost = newFirst.join(":") + "::" + newLast.join(":");6089} else {6090newHost = fields.join(":");6091}6092if (zone) {6093newHost += "%" + zone;6094}6095return newHost;6096} else {6097return host;6098}6099}6100var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;6101var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;6102function parse(uriString) {6103var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};61046105var components = {};6106var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;6107if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;6108var matches = uriString.match(URI_PARSE);6109if (matches) {6110if (NO_MATCH_IS_UNDEFINED) {6111//store each component6112components.scheme = matches[1];6113components.userinfo = matches[3];6114components.host = matches[4];6115components.port = parseInt(matches[5], 10);6116components.path = matches[6] || "";6117components.query = matches[7];6118components.fragment = matches[8];6119//fix port number6120if (isNaN(components.port)) {6121components.port = matches[5];6122}6123} else {6124//IE FIX for improper RegExp matching6125//store each component6126components.scheme = matches[1] || undefined;6127components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;6128components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;6129components.port = parseInt(matches[5], 10);6130components.path = matches[6] || "";6131components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;6132components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;6133//fix port number6134if (isNaN(components.port)) {6135components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;6136}6137}6138if (components.host) {6139//normalize IP hosts6140components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);6141}6142//determine reference type6143if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {6144components.reference = "same-document";6145} else if (components.scheme === undefined) {6146components.reference = "relative";6147} else if (components.fragment === undefined) {6148components.reference = "absolute";6149} else {6150components.reference = "uri";6151}6152//check for reference errors6153if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {6154components.error = components.error || "URI is not a " + options.reference + " reference.";6155}6156//find scheme handler6157var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];6158//check if scheme can't handle IRIs6159if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {6160//if host component is a domain name6161if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {6162//convert Unicode IDN -> ASCII IDN6163try {6164components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());6165} catch (e) {6166components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;6167}6168}6169//convert IRI -> URI6170_normalizeComponentEncoding(components, URI_PROTOCOL);6171} else {6172//normalize encodings6173_normalizeComponentEncoding(components, protocol);6174}6175//perform scheme specific parsing6176if (schemeHandler && schemeHandler.parse) {6177schemeHandler.parse(components, options);6178}6179} else {6180components.error = components.error || "URI can not be parsed.";6181}6182return components;6183}61846185function _recomposeAuthority(components, options) {6186var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;6187var uriTokens = [];6188if (components.userinfo !== undefined) {6189uriTokens.push(components.userinfo);6190uriTokens.push("@");6191}6192if (components.host !== undefined) {6193//normalize IP hosts, add brackets and escape zone separator for IPv66194uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {6195return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";6196}));6197}6198if (typeof components.port === "number" || typeof components.port === "string") {6199uriTokens.push(":");6200uriTokens.push(String(components.port));6201}6202return uriTokens.length ? uriTokens.join("") : undefined;6203}62046205var RDS1 = /^\.\.?\//;6206var RDS2 = /^\/\.(\/|$)/;6207var RDS3 = /^\/\.\.(\/|$)/;6208var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;6209function removeDotSegments(input) {6210var output = [];6211while (input.length) {6212if (input.match(RDS1)) {6213input = input.replace(RDS1, "");6214} else if (input.match(RDS2)) {6215input = input.replace(RDS2, "/");6216} else if (input.match(RDS3)) {6217input = input.replace(RDS3, "/");6218output.pop();6219} else if (input === "." || input === "..") {6220input = "";6221} else {6222var im = input.match(RDS5);6223if (im) {6224var s = im[0];6225input = input.slice(s.length);6226output.push(s);6227} else {6228throw new Error("Unexpected dot segment condition");6229}6230}6231}6232return output.join("");6233}62346235function serialize(components) {6236var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};62376238var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;6239var uriTokens = [];6240//find scheme handler6241var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];6242//perform scheme specific serialization6243if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);6244if (components.host) {6245//if host component is an IPv6 address6246if (protocol.IPV6ADDRESS.test(components.host)) {}6247//TODO: normalize IPv6 address as per RFC 595262486249//if host component is a domain name6250else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {6251//convert IDN via punycode6252try {6253components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);6254} catch (e) {6255components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;6256}6257}6258}6259//normalize encoding6260_normalizeComponentEncoding(components, protocol);6261if (options.reference !== "suffix" && components.scheme) {6262uriTokens.push(components.scheme);6263uriTokens.push(":");6264}6265var authority = _recomposeAuthority(components, options);6266if (authority !== undefined) {6267if (options.reference !== "suffix") {6268uriTokens.push("//");6269}6270uriTokens.push(authority);6271if (components.path && components.path.charAt(0) !== "/") {6272uriTokens.push("/");6273}6274}6275if (components.path !== undefined) {6276var s = components.path;6277if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {6278s = removeDotSegments(s);6279}6280if (authority === undefined) {6281s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"6282}6283uriTokens.push(s);6284}6285if (components.query !== undefined) {6286uriTokens.push("?");6287uriTokens.push(components.query);6288}6289if (components.fragment !== undefined) {6290uriTokens.push("#");6291uriTokens.push(components.fragment);6292}6293return uriTokens.join(""); //merge tokens into a string6294}62956296function resolveComponents(base, relative) {6297var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};6298var skipNormalization = arguments[3];62996300var target = {};6301if (!skipNormalization) {6302base = parse(serialize(base, options), options); //normalize base components6303relative = parse(serialize(relative, options), options); //normalize relative components6304}6305options = options || {};6306if (!options.tolerant && relative.scheme) {6307target.scheme = relative.scheme;6308//target.authority = relative.authority;6309target.userinfo = relative.userinfo;6310target.host = relative.host;6311target.port = relative.port;6312target.path = removeDotSegments(relative.path || "");6313target.query = relative.query;6314} else {6315if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {6316//target.authority = relative.authority;6317target.userinfo = relative.userinfo;6318target.host = relative.host;6319target.port = relative.port;6320target.path = removeDotSegments(relative.path || "");6321target.query = relative.query;6322} else {6323if (!relative.path) {6324target.path = base.path;6325if (relative.query !== undefined) {6326target.query = relative.query;6327} else {6328target.query = base.query;6329}6330} else {6331if (relative.path.charAt(0) === "/") {6332target.path = removeDotSegments(relative.path);6333} else {6334if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {6335target.path = "/" + relative.path;6336} else if (!base.path) {6337target.path = relative.path;6338} else {6339target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;6340}6341target.path = removeDotSegments(target.path);6342}6343target.query = relative.query;6344}6345//target.authority = base.authority;6346target.userinfo = base.userinfo;6347target.host = base.host;6348target.port = base.port;6349}6350target.scheme = base.scheme;6351}6352target.fragment = relative.fragment;6353return target;6354}63556356function resolve(baseURI, relativeURI, options) {6357var schemelessOptions = assign({ scheme: 'null' }, options);6358return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);6359}63606361function normalize(uri, options) {6362if (typeof uri === "string") {6363uri = serialize(parse(uri, options), options);6364} else if (typeOf(uri) === "object") {6365uri = parse(serialize(uri, options), options);6366}6367return uri;6368}63696370function equal(uriA, uriB, options) {6371if (typeof uriA === "string") {6372uriA = serialize(parse(uriA, options), options);6373} else if (typeOf(uriA) === "object") {6374uriA = serialize(uriA, options);6375}6376if (typeof uriB === "string") {6377uriB = serialize(parse(uriB, options), options);6378} else if (typeOf(uriB) === "object") {6379uriB = serialize(uriB, options);6380}6381return uriA === uriB;6382}63836384function escapeComponent(str, options) {6385return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);6386}63876388function unescapeComponent(str, options) {6389return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);6390}63916392var handler = {6393scheme: "http",6394domainHost: true,6395parse: function parse(components, options) {6396//report missing host6397if (!components.host) {6398components.error = components.error || "HTTP URIs must have a host.";6399}6400return components;6401},6402serialize: function serialize(components, options) {6403var secure = String(components.scheme).toLowerCase() === "https";6404//normalize the default port6405if (components.port === (secure ? 443 : 80) || components.port === "") {6406components.port = undefined;6407}6408//normalize the empty path6409if (!components.path) {6410components.path = "/";6411}6412//NOTE: We do not parse query strings for HTTP URIs6413//as WWW Form Url Encoded query strings are part of the HTML4+ spec,6414//and not the HTTP spec.6415return components;6416}6417};64186419var handler$1 = {6420scheme: "https",6421domainHost: handler.domainHost,6422parse: handler.parse,6423serialize: handler.serialize6424};64256426function isSecure(wsComponents) {6427return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";6428}6429//RFC 64556430var handler$2 = {6431scheme: "ws",6432domainHost: true,6433parse: function parse(components, options) {6434var wsComponents = components;6435//indicate if the secure flag is set6436wsComponents.secure = isSecure(wsComponents);6437//construct resouce name6438wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');6439wsComponents.path = undefined;6440wsComponents.query = undefined;6441return wsComponents;6442},6443serialize: function serialize(wsComponents, options) {6444//normalize the default port6445if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {6446wsComponents.port = undefined;6447}6448//ensure scheme matches secure flag6449if (typeof wsComponents.secure === 'boolean') {6450wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';6451wsComponents.secure = undefined;6452}6453//reconstruct path from resource name6454if (wsComponents.resourceName) {6455var _wsComponents$resourc = wsComponents.resourceName.split('?'),6456_wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),6457path = _wsComponents$resourc2[0],6458query = _wsComponents$resourc2[1];64596460wsComponents.path = path && path !== '/' ? path : undefined;6461wsComponents.query = query;6462wsComponents.resourceName = undefined;6463}6464//forbid fragment component6465wsComponents.fragment = undefined;6466return wsComponents;6467}6468};64696470var handler$3 = {6471scheme: "wss",6472domainHost: handler$2.domainHost,6473parse: handler$2.parse,6474serialize: handler$2.serialize6475};64766477var O = {};6478var isIRI = true;6479//RFC 39866480var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";6481var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive6482var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded6483//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =6484//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";6485//const WSP$$ = "[\\x20\\x09]";6486//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)6487//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext6488//const VCHAR$$ = "[\\x21-\\x7E]";6489//const WSP$$ = "[\\x20\\x09]";6490//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext6491//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");6492//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);6493//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');6494var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";6495var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";6496var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");6497var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";6498var UNRESERVED = new RegExp(UNRESERVED$$, "g");6499var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");6500var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");6501var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");6502var NOT_HFVALUE = NOT_HFNAME;6503function decodeUnreserved(str) {6504var decStr = pctDecChars(str);6505return !decStr.match(UNRESERVED) ? str : decStr;6506}6507var handler$4 = {6508scheme: "mailto",6509parse: function parse$$1(components, options) {6510var mailtoComponents = components;6511var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];6512mailtoComponents.path = undefined;6513if (mailtoComponents.query) {6514var unknownHeaders = false;6515var headers = {};6516var hfields = mailtoComponents.query.split("&");6517for (var x = 0, xl = hfields.length; x < xl; ++x) {6518var hfield = hfields[x].split("=");6519switch (hfield[0]) {6520case "to":6521var toAddrs = hfield[1].split(",");6522for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {6523to.push(toAddrs[_x]);6524}6525break;6526case "subject":6527mailtoComponents.subject = unescapeComponent(hfield[1], options);6528break;6529case "body":6530mailtoComponents.body = unescapeComponent(hfield[1], options);6531break;6532default:6533unknownHeaders = true;6534headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);6535break;6536}6537}6538if (unknownHeaders) mailtoComponents.headers = headers;6539}6540mailtoComponents.query = undefined;6541for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {6542var addr = to[_x2].split("@");6543addr[0] = unescapeComponent(addr[0]);6544if (!options.unicodeSupport) {6545//convert Unicode IDN -> ASCII IDN6546try {6547addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());6548} catch (e) {6549mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;6550}6551} else {6552addr[1] = unescapeComponent(addr[1], options).toLowerCase();6553}6554to[_x2] = addr.join("@");6555}6556return mailtoComponents;6557},6558serialize: function serialize$$1(mailtoComponents, options) {6559var components = mailtoComponents;6560var to = toArray(mailtoComponents.to);6561if (to) {6562for (var x = 0, xl = to.length; x < xl; ++x) {6563var toAddr = String(to[x]);6564var atIdx = toAddr.lastIndexOf("@");6565var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);6566var domain = toAddr.slice(atIdx + 1);6567//convert IDN via punycode6568try {6569domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);6570} catch (e) {6571components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;6572}6573to[x] = localPart + "@" + domain;6574}6575components.path = to.join(",");6576}6577var headers = mailtoComponents.headers = mailtoComponents.headers || {};6578if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;6579if (mailtoComponents.body) headers["body"] = mailtoComponents.body;6580var fields = [];6581for (var name in headers) {6582if (headers[name] !== O[name]) {6583fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));6584}6585}6586if (fields.length) {6587components.query = fields.join("&");6588}6589return components;6590}6591};65926593var URN_PARSE = /^([^\:]+)\:(.*)/;6594//RFC 21416595var handler$5 = {6596scheme: "urn",6597parse: function parse$$1(components, options) {6598var matches = components.path && components.path.match(URN_PARSE);6599var urnComponents = components;6600if (matches) {6601var scheme = options.scheme || urnComponents.scheme || "urn";6602var nid = matches[1].toLowerCase();6603var nss = matches[2];6604var urnScheme = scheme + ":" + (options.nid || nid);6605var schemeHandler = SCHEMES[urnScheme];6606urnComponents.nid = nid;6607urnComponents.nss = nss;6608urnComponents.path = undefined;6609if (schemeHandler) {6610urnComponents = schemeHandler.parse(urnComponents, options);6611}6612} else {6613urnComponents.error = urnComponents.error || "URN can not be parsed.";6614}6615return urnComponents;6616},6617serialize: function serialize$$1(urnComponents, options) {6618var scheme = options.scheme || urnComponents.scheme || "urn";6619var nid = urnComponents.nid;6620var urnScheme = scheme + ":" + (options.nid || nid);6621var schemeHandler = SCHEMES[urnScheme];6622if (schemeHandler) {6623urnComponents = schemeHandler.serialize(urnComponents, options);6624}6625var uriComponents = urnComponents;6626var nss = urnComponents.nss;6627uriComponents.path = (nid || options.nid) + ":" + nss;6628return uriComponents;6629}6630};66316632var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;6633//RFC 41226634var handler$6 = {6635scheme: "urn:uuid",6636parse: function parse(urnComponents, options) {6637var uuidComponents = urnComponents;6638uuidComponents.uuid = uuidComponents.nss;6639uuidComponents.nss = undefined;6640if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {6641uuidComponents.error = uuidComponents.error || "UUID is not valid.";6642}6643return uuidComponents;6644},6645serialize: function serialize(uuidComponents, options) {6646var urnComponents = uuidComponents;6647//normalize UUID6648urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();6649return urnComponents;6650}6651};66526653SCHEMES[handler.scheme] = handler;6654SCHEMES[handler$1.scheme] = handler$1;6655SCHEMES[handler$2.scheme] = handler$2;6656SCHEMES[handler$3.scheme] = handler$3;6657SCHEMES[handler$4.scheme] = handler$4;6658SCHEMES[handler$5.scheme] = handler$5;6659SCHEMES[handler$6.scheme] = handler$6;66606661exports.SCHEMES = SCHEMES;6662exports.pctEncChar = pctEncChar;6663exports.pctDecChars = pctDecChars;6664exports.parse = parse;6665exports.removeDotSegments = removeDotSegments;6666exports.serialize = serialize;6667exports.resolveComponents = resolveComponents;6668exports.resolve = resolve;6669exports.normalize = normalize;6670exports.equal = equal;6671exports.escapeComponent = escapeComponent;6672exports.unescapeComponent = unescapeComponent;66736674Object.defineProperty(exports, '__esModule', { value: true });66756676})));667766786679},{}],"ajv":[function(require,module,exports){6680'use strict';66816682var compileSchema = require('./compile')6683, resolve = require('./compile/resolve')6684, Cache = require('./cache')6685, SchemaObject = require('./compile/schema_obj')6686, stableStringify = require('fast-json-stable-stringify')6687, formats = require('./compile/formats')6688, rules = require('./compile/rules')6689, $dataMetaSchema = require('./data')6690, util = require('./compile/util');66916692module.exports = Ajv;66936694Ajv.prototype.validate = validate;6695Ajv.prototype.compile = compile;6696Ajv.prototype.addSchema = addSchema;6697Ajv.prototype.addMetaSchema = addMetaSchema;6698Ajv.prototype.validateSchema = validateSchema;6699Ajv.prototype.getSchema = getSchema;6700Ajv.prototype.removeSchema = removeSchema;6701Ajv.prototype.addFormat = addFormat;6702Ajv.prototype.errorsText = errorsText;67036704Ajv.prototype._addSchema = _addSchema;6705Ajv.prototype._compile = _compile;67066707Ajv.prototype.compileAsync = require('./compile/async');6708var customKeyword = require('./keyword');6709Ajv.prototype.addKeyword = customKeyword.add;6710Ajv.prototype.getKeyword = customKeyword.get;6711Ajv.prototype.removeKeyword = customKeyword.remove;6712Ajv.prototype.validateKeyword = customKeyword.validate;67136714var errorClasses = require('./compile/error_classes');6715Ajv.ValidationError = errorClasses.Validation;6716Ajv.MissingRefError = errorClasses.MissingRef;6717Ajv.$dataMetaSchema = $dataMetaSchema;67186719var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';67206721var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];6722var META_SUPPORT_DATA = ['/properties'];67236724/**6725* Creates validator instance.6726* Usage: `Ajv(opts)`6727* @param {Object} opts optional options6728* @return {Object} ajv instance6729*/6730function Ajv(opts) {6731if (!(this instanceof Ajv)) return new Ajv(opts);6732opts = this._opts = util.copy(opts) || {};6733setLogger(this);6734this._schemas = {};6735this._refs = {};6736this._fragments = {};6737this._formats = formats(opts.format);67386739this._cache = opts.cache || new Cache;6740this._loadingSchemas = {};6741this._compilations = [];6742this.RULES = rules();6743this._getId = chooseGetId(opts);67446745opts.loopRequired = opts.loopRequired || Infinity;6746if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;6747if (opts.serialize === undefined) opts.serialize = stableStringify;6748this._metaOpts = getMetaSchemaOptions(this);67496750if (opts.formats) addInitialFormats(this);6751if (opts.keywords) addInitialKeywords(this);6752addDefaultMetaSchema(this);6753if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);6754if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});6755addInitialSchemas(this);6756}6757675867596760/**6761* Validate data using schema6762* Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.6763* @this Ajv6764* @param {String|Object} schemaKeyRef key, ref or schema object6765* @param {Any} data to be validated6766* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).6767*/6768function validate(schemaKeyRef, data) {6769var v;6770if (typeof schemaKeyRef == 'string') {6771v = this.getSchema(schemaKeyRef);6772if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');6773} else {6774var schemaObj = this._addSchema(schemaKeyRef);6775v = schemaObj.validate || this._compile(schemaObj);6776}67776778var valid = v(data);6779if (v.$async !== true) this.errors = v.errors;6780return valid;6781}678267836784/**6785* Create validating function for passed schema.6786* @this Ajv6787* @param {Object} schema schema object6788* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.6789* @return {Function} validating function6790*/6791function compile(schema, _meta) {6792var schemaObj = this._addSchema(schema, undefined, _meta);6793return schemaObj.validate || this._compile(schemaObj);6794}679567966797/**6798* Adds schema to the instance.6799* @this Ajv6800* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.6801* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.6802* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.6803* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.6804* @return {Ajv} this for method chaining6805*/6806function addSchema(schema, key, _skipValidation, _meta) {6807if (Array.isArray(schema)){6808for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);6809return this;6810}6811var id = this._getId(schema);6812if (id !== undefined && typeof id != 'string')6813throw new Error('schema id must be string');6814key = resolve.normalizeId(key || id);6815checkUnique(this, key);6816this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);6817return this;6818}681968206821/**6822* Add schema that will be used to validate other schemas6823* options in META_IGNORE_OPTIONS are alway set to false6824* @this Ajv6825* @param {Object} schema schema object6826* @param {String} key optional schema key6827* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema6828* @return {Ajv} this for method chaining6829*/6830function addMetaSchema(schema, key, skipValidation) {6831this.addSchema(schema, key, skipValidation, true);6832return this;6833}683468356836/**6837* Validate schema6838* @this Ajv6839* @param {Object} schema schema to validate6840* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid6841* @return {Boolean} true if schema is valid6842*/6843function validateSchema(schema, throwOrLogError) {6844var $schema = schema.$schema;6845if ($schema !== undefined && typeof $schema != 'string')6846throw new Error('$schema must be a string');6847$schema = $schema || this._opts.defaultMeta || defaultMeta(this);6848if (!$schema) {6849this.logger.warn('meta-schema not available');6850this.errors = null;6851return true;6852}6853var valid = this.validate($schema, schema);6854if (!valid && throwOrLogError) {6855var message = 'schema is invalid: ' + this.errorsText();6856if (this._opts.validateSchema == 'log') this.logger.error(message);6857else throw new Error(message);6858}6859return valid;6860}686168626863function defaultMeta(self) {6864var meta = self._opts.meta;6865self._opts.defaultMeta = typeof meta == 'object'6866? self._getId(meta) || meta6867: self.getSchema(META_SCHEMA_ID)6868? META_SCHEMA_ID6869: undefined;6870return self._opts.defaultMeta;6871}687268736874/**6875* Get compiled schema from the instance by `key` or `ref`.6876* @this Ajv6877* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).6878* @return {Function} schema validating function (with property `schema`).6879*/6880function getSchema(keyRef) {6881var schemaObj = _getSchemaObj(this, keyRef);6882switch (typeof schemaObj) {6883case 'object': return schemaObj.validate || this._compile(schemaObj);6884case 'string': return this.getSchema(schemaObj);6885case 'undefined': return _getSchemaFragment(this, keyRef);6886}6887}688868896890function _getSchemaFragment(self, ref) {6891var res = resolve.schema.call(self, { schema: {} }, ref);6892if (res) {6893var schema = res.schema6894, root = res.root6895, baseId = res.baseId;6896var v = compileSchema.call(self, schema, root, undefined, baseId);6897self._fragments[ref] = new SchemaObject({6898ref: ref,6899fragment: true,6900schema: schema,6901root: root,6902baseId: baseId,6903validate: v6904});6905return v;6906}6907}690869096910function _getSchemaObj(self, keyRef) {6911keyRef = resolve.normalizeId(keyRef);6912return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];6913}691469156916/**6917* Remove cached schema(s).6918* If no parameter is passed all schemas but meta-schemas are removed.6919* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.6920* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.6921* @this Ajv6922* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object6923* @return {Ajv} this for method chaining6924*/6925function removeSchema(schemaKeyRef) {6926if (schemaKeyRef instanceof RegExp) {6927_removeAllSchemas(this, this._schemas, schemaKeyRef);6928_removeAllSchemas(this, this._refs, schemaKeyRef);6929return this;6930}6931switch (typeof schemaKeyRef) {6932case 'undefined':6933_removeAllSchemas(this, this._schemas);6934_removeAllSchemas(this, this._refs);6935this._cache.clear();6936return this;6937case 'string':6938var schemaObj = _getSchemaObj(this, schemaKeyRef);6939if (schemaObj) this._cache.del(schemaObj.cacheKey);6940delete this._schemas[schemaKeyRef];6941delete this._refs[schemaKeyRef];6942return this;6943case 'object':6944var serialize = this._opts.serialize;6945var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;6946this._cache.del(cacheKey);6947var id = this._getId(schemaKeyRef);6948if (id) {6949id = resolve.normalizeId(id);6950delete this._schemas[id];6951delete this._refs[id];6952}6953}6954return this;6955}695669576958function _removeAllSchemas(self, schemas, regex) {6959for (var keyRef in schemas) {6960var schemaObj = schemas[keyRef];6961if (!schemaObj.meta && (!regex || regex.test(keyRef))) {6962self._cache.del(schemaObj.cacheKey);6963delete schemas[keyRef];6964}6965}6966}696769686969/* @this Ajv */6970function _addSchema(schema, skipValidation, meta, shouldAddSchema) {6971if (typeof schema != 'object' && typeof schema != 'boolean')6972throw new Error('schema should be object or boolean');6973var serialize = this._opts.serialize;6974var cacheKey = serialize ? serialize(schema) : schema;6975var cached = this._cache.get(cacheKey);6976if (cached) return cached;69776978shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;69796980var id = resolve.normalizeId(this._getId(schema));6981if (id && shouldAddSchema) checkUnique(this, id);69826983var willValidate = this._opts.validateSchema !== false && !skipValidation;6984var recursiveMeta;6985if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))6986this.validateSchema(schema, true);69876988var localRefs = resolve.ids.call(this, schema);69896990var schemaObj = new SchemaObject({6991id: id,6992schema: schema,6993localRefs: localRefs,6994cacheKey: cacheKey,6995meta: meta6996});69976998if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;6999this._cache.put(cacheKey, schemaObj);70007001if (willValidate && recursiveMeta) this.validateSchema(schema, true);70027003return schemaObj;7004}700570067007/* @this Ajv */7008function _compile(schemaObj, root) {7009if (schemaObj.compiling) {7010schemaObj.validate = callValidate;7011callValidate.schema = schemaObj.schema;7012callValidate.errors = null;7013callValidate.root = root ? root : callValidate;7014if (schemaObj.schema.$async === true)7015callValidate.$async = true;7016return callValidate;7017}7018schemaObj.compiling = true;70197020var currentOpts;7021if (schemaObj.meta) {7022currentOpts = this._opts;7023this._opts = this._metaOpts;7024}70257026var v;7027try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }7028catch(e) {7029delete schemaObj.validate;7030throw e;7031}7032finally {7033schemaObj.compiling = false;7034if (schemaObj.meta) this._opts = currentOpts;7035}70367037schemaObj.validate = v;7038schemaObj.refs = v.refs;7039schemaObj.refVal = v.refVal;7040schemaObj.root = v.root;7041return v;704270437044/* @this {*} - custom context, see passContext option */7045function callValidate() {7046/* jshint validthis: true */7047var _validate = schemaObj.validate;7048var result = _validate.apply(this, arguments);7049callValidate.errors = _validate.errors;7050return result;7051}7052}705370547055function chooseGetId(opts) {7056switch (opts.schemaId) {7057case 'auto': return _get$IdOrId;7058case 'id': return _getId;7059default: return _get$Id;7060}7061}70627063/* @this Ajv */7064function _getId(schema) {7065if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);7066return schema.id;7067}70687069/* @this Ajv */7070function _get$Id(schema) {7071if (schema.id) this.logger.warn('schema id ignored', schema.id);7072return schema.$id;7073}707470757076function _get$IdOrId(schema) {7077if (schema.$id && schema.id && schema.$id != schema.id)7078throw new Error('schema $id is different from id');7079return schema.$id || schema.id;7080}708170827083/**7084* Convert array of error message objects to string7085* @this Ajv7086* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.7087* @param {Object} options optional options with properties `separator` and `dataVar`.7088* @return {String} human readable string with all errors descriptions7089*/7090function errorsText(errors, options) {7091errors = errors || this.errors;7092if (!errors) return 'No errors';7093options = options || {};7094var separator = options.separator === undefined ? ', ' : options.separator;7095var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;70967097var text = '';7098for (var i=0; i<errors.length; i++) {7099var e = errors[i];7100if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;7101}7102return text.slice(0, -separator.length);7103}710471057106/**7107* Add custom format7108* @this Ajv7109* @param {String} name format name7110* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)7111* @return {Ajv} this for method chaining7112*/7113function addFormat(name, format) {7114if (typeof format == 'string') format = new RegExp(format);7115this._formats[name] = format;7116return this;7117}711871197120function addDefaultMetaSchema(self) {7121var $dataSchema;7122if (self._opts.$data) {7123$dataSchema = require('./refs/data.json');7124self.addMetaSchema($dataSchema, $dataSchema.$id, true);7125}7126if (self._opts.meta === false) return;7127var metaSchema = require('./refs/json-schema-draft-07.json');7128if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);7129self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);7130self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;7131}713271337134function addInitialSchemas(self) {7135var optsSchemas = self._opts.schemas;7136if (!optsSchemas) return;7137if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);7138else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);7139}714071417142function addInitialFormats(self) {7143for (var name in self._opts.formats) {7144var format = self._opts.formats[name];7145self.addFormat(name, format);7146}7147}714871497150function addInitialKeywords(self) {7151for (var name in self._opts.keywords) {7152var keyword = self._opts.keywords[name];7153self.addKeyword(name, keyword);7154}7155}715671577158function checkUnique(self, id) {7159if (self._schemas[id] || self._refs[id])7160throw new Error('schema with key or id "' + id + '" already exists');7161}716271637164function getMetaSchemaOptions(self) {7165var metaOpts = util.copy(self._opts);7166for (var i=0; i<META_IGNORE_OPTIONS.length; i++)7167delete metaOpts[META_IGNORE_OPTIONS[i]];7168return metaOpts;7169}717071717172function setLogger(self) {7173var logger = self._opts.logger;7174if (logger === false) {7175self.logger = {log: noop, warn: noop, error: noop};7176} else {7177if (logger === undefined) logger = console;7178if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))7179throw new Error('logger must implement log, warn and error methods');7180self.logger = logger;7181}7182}718371847185function noop() {}71867187},{"./cache":1,"./compile":5,"./compile/async":2,"./compile/error_classes":3,"./compile/formats":4,"./compile/resolve":6,"./compile/rules":7,"./compile/schema_obj":8,"./compile/util":10,"./data":11,"./keyword":39,"./refs/data.json":40,"./refs/json-schema-draft-07.json":41,"fast-json-stable-stringify":43}]},{},[])("ajv")7188});718971907191