diff --git a/dist/swagger-parser.js b/dist/swagger-parser.js index 451745ec..233c7605 100644 --- a/dist/swagger-parser.js +++ b/dist/swagger-parser.js @@ -176,7 +176,7 @@ SwaggerParser.prototype.validate = function(api, options, callback) { * @typedef {{swagger: string, info: {}, paths: {}}} SwaggerObject */ -},{"./options":2,"./promise":3,"./util":4,"./validate-schema":5,"./validate-spec":6,"call-me-maybe":12,"json-schema-ref-parser":55,"json-schema-ref-parser/lib/dereference":54,"ono":76}],2:[function(require,module,exports){ +},{"./options":2,"./promise":3,"./util":4,"./validate-schema":5,"./validate-spec":6,"call-me-maybe":13,"json-schema-ref-parser":59,"json-schema-ref-parser/lib/dereference":58,"ono":75}],2:[function(require,module,exports){ 'use strict'; var $RefParserOptions = require('json-schema-ref-parser/lib/options'), @@ -202,13 +202,13 @@ function ParserOptions(options) { util.inherits(ParserOptions, $RefParserOptions); -},{"json-schema-ref-parser/lib/options":56,"util":106}],3:[function(require,module,exports){ +},{"json-schema-ref-parser/lib/options":60,"util":104}],3:[function(require,module,exports){ 'use strict'; /** @type {Promise} **/ module.exports = typeof Promise === 'function' ? Promise : require('es6-promise').Promise; -},{"es6-promise":16}],4:[function(require,module,exports){ +},{"es6-promise":17}],4:[function(require,module,exports){ 'use strict'; var debug = require('debug'), @@ -229,7 +229,7 @@ exports.debug = debug('swagger:parser'); */ exports.swaggerParamRegExp = /\{([^/}]+)}/g; -},{"debug":14,"util":106}],5:[function(require,module,exports){ +},{"debug":15,"util":104}],5:[function(require,module,exports){ 'use strict'; var util = require('./util'), @@ -294,7 +294,7 @@ function formatZSchemaError(errors, indent) { return message; } -},{"./util":4,"ono":76,"swagger-schema-official/schema":100,"z-schema":180}],6:[function(require,module,exports){ +},{"./util":4,"ono":75,"swagger-schema-official/schema":99,"z-schema":116}],6:[function(require,module,exports){ 'use strict'; var util = require('./util'), @@ -579,7 +579,7 @@ function validateSchema(schema, schemaId, validTypes) { } } -},{"./util":4,"ono":76,"swagger-methods":99}],7:[function(require,module,exports){ +},{"./util":4,"ono":75,"swagger-methods":98}],7:[function(require,module,exports){ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; ;(function (exports) { @@ -2262,7 +2262,14 @@ function blitBuffer (src, dst, offset, length) { }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":7,"ieee754":19,"isarray":22}],11:[function(require,module,exports){ +},{"base64-js":7,"ieee754":21,"isarray":11}],11:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +},{}],12:[function(require,module,exports){ module.exports = { "100": "Continue", "101": "Switching Protocols", @@ -2275,11 +2282,9 @@ module.exports = { "205": "Reset Content", "206": "Partial Content", "207": "Multi-Status", - "208": "Already Reported", - "226": "IM Used", "300": "Multiple Choices", "301": "Moved Permanently", - "302": "Found", + "302": "Moved Temporarily", "303": "See Other", "304": "Not Modified", "305": "Use Proxy", @@ -2293,18 +2298,17 @@ module.exports = { "405": "Method Not Allowed", "406": "Not Acceptable", "407": "Proxy Authentication Required", - "408": "Request Timeout", + "408": "Request Time-out", "409": "Conflict", "410": "Gone", "411": "Length Required", "412": "Precondition Failed", - "413": "Payload Too Large", - "414": "URI Too Long", + "413": "Request Entity Too Large", + "414": "Request-URI Too Large", "415": "Unsupported Media Type", - "416": "Range Not Satisfiable", + "416": "Requested Range Not Satisfiable", "417": "Expectation Failed", "418": "I'm a teapot", - "421": "Misdirected Request", "422": "Unprocessable Entity", "423": "Locked", "424": "Failed Dependency", @@ -2317,17 +2321,16 @@ module.exports = { "501": "Not Implemented", "502": "Bad Gateway", "503": "Service Unavailable", - "504": "Gateway Timeout", + "504": "Gateway Time-out", "505": "HTTP Version Not Supported", "506": "Variant Also Negotiates", "507": "Insufficient Storage", - "508": "Loop Detected", "509": "Bandwidth Limit Exceeded", "510": "Not Extended", "511": "Network Authentication Required" } -},{}],12:[function(require,module,exports){ +},{}],13:[function(require,module,exports){ (function (process,global){ "use strict" @@ -2352,7 +2355,7 @@ module.exports = function maybe (cb, promise) { }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":78}],13:[function(require,module,exports){ +},{"_process":77}],14:[function(require,module,exports){ (function (Buffer){ // Copyright Joyent, Inc. and other Node contributors. // @@ -2464,7 +2467,7 @@ function objectToString(o) { }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":21}],14:[function(require,module,exports){ +},{"../../is-buffer/index.js":25}],15:[function(require,module,exports){ /** * This is the web browser implementation of `debug()`. @@ -2634,7 +2637,7 @@ function localstorage(){ } catch (e) {} } -},{"./debug":15}],15:[function(require,module,exports){ +},{"./debug":16}],16:[function(require,module,exports){ /** * This is the common logic for both the Node.js and web browser @@ -2833,14 +2836,14 @@ function coerce(val) { return val; } -},{"ms":75}],16:[function(require,module,exports){ +},{"ms":74}],17:[function(require,module,exports){ (function (process,global){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE - * @version 3.1.2 + * @version 3.0.2 */ (function() { @@ -2868,6 +2871,7 @@ function coerce(val) { var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; var lib$es6$promise$asap$$vertxNext; var lib$es6$promise$asap$$customSchedulerFn; @@ -2986,42 +2990,6 @@ function coerce(val) { } else { lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); } - function lib$es6$promise$then$$then(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$asap(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - } - var lib$es6$promise$then$$default = lib$es6$promise$then$$then; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; function lib$es6$promise$$internal$$noop() {} @@ -3095,12 +3063,12 @@ function coerce(val) { } } - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) { - if (maybeThenable.constructor === promise.constructor && - then === lib$es6$promise$then$$default && - constructor.resolve === lib$es6$promise$promise$resolve$$default) { + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); } else if (then === undefined) { @@ -3117,7 +3085,7 @@ function coerce(val) { if (promise === value) { lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment()); } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value)); + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); } else { lib$es6$promise$$internal$$fulfill(promise, value); } @@ -3252,6 +3220,104 @@ function coerce(val) { } } + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; function lib$es6$promise$promise$all$$all(entries) { return new lib$es6$promise$enumerator$$default(this, entries).promise; } @@ -3284,6 +3350,19 @@ function coerce(val) { return promise; } var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; function lib$es6$promise$promise$reject$$reject(reason) { /*jshint validthis:true */ var Constructor = this; @@ -3414,8 +3493,15 @@ function coerce(val) { this._subscribers = []; if (lib$es6$promise$$internal$$noop !== resolver) { - typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver(); - this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew(); + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); } } @@ -3623,7 +3709,28 @@ function coerce(val) { Useful for tooling. @return {Promise} */ - then: lib$es6$promise$then$$default, + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, /** `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same @@ -3656,97 +3763,6 @@ function coerce(val) { return this.then(null, onRejection); } }; - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - this._instanceConstructor = Constructor; - this.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (Array.isArray(input)) { - this._input = input; - this.length = input.length; - this._remaining = input.length; - - this._result = new Array(this.length); - - if (this.length === 0) { - lib$es6$promise$$internal$$fulfill(this.promise, this._result); - } else { - this.length = this.length || 0; - this._enumerate(); - if (this._remaining === 0) { - lib$es6$promise$$internal$$fulfill(this.promise, this._result); - } - } - } else { - lib$es6$promise$$internal$$reject(this.promise, this._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var length = this.length; - var input = this._input; - - for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - this._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var c = this._instanceConstructor; - var resolve = c.resolve; - - if (resolve === lib$es6$promise$promise$resolve$$default) { - var then = lib$es6$promise$$internal$$getThen(entry); - - if (then === lib$es6$promise$then$$default && - entry._state !== lib$es6$promise$$internal$$PENDING) { - this._settledAt(entry._state, i, entry._result); - } else if (typeof then !== 'function') { - this._remaining--; - this._result[i] = entry; - } else if (c === lib$es6$promise$promise$$default) { - var promise = new c(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then); - this._willSettleAt(promise, i); - } else { - this._willSettleAt(new c(function(resolve) { resolve(entry); }), i); - } - } else { - this._willSettleAt(resolve(entry), i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var promise = this.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - this._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - this._result[i] = value; - } - } - - if (this._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, this._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; function lib$es6$promise$polyfill$$polyfill() { var local; @@ -3792,17035 +3808,20450 @@ function coerce(val) { }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":78}],17:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +},{"_process":77}],18:[function(require,module,exports){ +/* + Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; +(function (root, factory) { + 'use strict'; -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; + // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, + // Rhino, and plain browser loading. -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; + /* istanbul ignore next */ + if (typeof define === 'function' && define.amd) { + define(['exports'], factory); + } else if (typeof exports !== 'undefined') { + factory(exports); + } else { + factory((root.esprima = {})); + } +}(this, function (exports) { + 'use strict'; + + var Token, + TokenName, + FnExprTokens, + Syntax, + PlaceHolders, + Messages, + Regex, + source, + strict, + index, + lineNumber, + lineStart, + hasLineTerminator, + lastIndex, + lastLineNumber, + lastLineStart, + startIndex, + startLineNumber, + startLineStart, + scanning, + length, + lookahead, + state, + extra, + isBindingElement, + isAssignmentTarget, + firstCoverInitializedNameError; + + Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8, + RegularExpression: 9, + Template: 10 + }; -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; + TokenName = {}; + TokenName[Token.BooleanLiteral] = 'Boolean'; + TokenName[Token.EOF] = ''; + TokenName[Token.Identifier] = 'Identifier'; + TokenName[Token.Keyword] = 'Keyword'; + TokenName[Token.NullLiteral] = 'Null'; + TokenName[Token.NumericLiteral] = 'Numeric'; + TokenName[Token.Punctuator] = 'Punctuator'; + TokenName[Token.StringLiteral] = 'String'; + TokenName[Token.RegularExpression] = 'RegularExpression'; + TokenName[Token.Template] = 'Template'; + + // A function following one of those tokens is an expression. + FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new', + 'return', 'case', 'delete', 'throw', 'void', + // assignment operators + '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=', + '&=', '|=', '^=', ',', + // binary/unary operators + '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&', + '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=', + '<=', '<', '>', '!=', '!==']; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; + PlaceHolders = { + ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder' + }; -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; + // Error messages should be identical to V8. + Messages = { + UnexpectedToken: 'Unexpected token %0', + UnexpectedNumber: 'Unexpected number', + UnexpectedString: 'Unexpected string', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedTemplate: 'Unexpected quasi %0', + UnexpectedEOS: 'Unexpected end of input', + NewlineAfterThrow: 'Illegal newline after throw', + InvalidRegExp: 'Invalid regular expression', + UnterminatedRegExp: 'Invalid regular expression: missing /', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NoCatchOrFinally: 'Missing catch or finally after try', + UnknownLabel: 'Undefined label \'%0\'', + Redeclaration: '%0 \'%1\' has already been declared', + IllegalContinue: 'Illegal continue statement', + IllegalBreak: 'Illegal break statement', + IllegalReturn: 'Illegal return statement', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode', + TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', + ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', + DefaultRestParameter: 'Unexpected token =', + ObjectPatternAsRestParameter: 'Unexpected token {', + DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', + ConstructorSpecialMethod: 'Class constructor may not be an accessor', + DuplicateConstructor: 'A class may only have one constructor', + StaticPrototype: 'Classes may not have static property named prototype', + MissingFromClause: 'Unexpected token', + NoAsAfterImportNamespace: 'Unexpected token', + InvalidModuleSpecifier: 'Unexpected token', + IllegalImportDeclaration: 'Unexpected token', + IllegalExportDeclaration: 'Unexpected token', + DuplicateBinding: 'Duplicate binding %0' + }; - if (!this._events) - this._events = {}; + // See also tools/generate-unicode-regex.js. + Regex = { + // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/, - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } - throw TypeError('Uncaught, unspecified "error" event.'); + // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ + }; + + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + + function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error('ASSERT: ' + message); + } } - } - handler = this._events[type]; + function isDecimalDigit(ch) { + return (ch >= 0x30 && ch <= 0x39); // 0..9 + } - if (isUndefined(handler)) - return false; + function isHexDigit(ch) { + return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; + } - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); + function isOctalDigit(ch) { + return '01234567'.indexOf(ch) >= 0; } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - - return true; -}; -EventEmitter.prototype.addListener = function(type, listener) { - var m; + function octalToDecimal(ch) { + // \0 is not octal escape sequence + var octal = (ch !== '0'), code = '01234567'.indexOf(ch); - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + '01234567'.indexOf(source[index++]); - if (!this._events) - this._events = {}; + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + isOctalDigit(source[index])) { + code = code * 8 + '01234567'.indexOf(source[index++]); + } + } - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); + return { + code: code, + octal: octal + }; + } - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; + // ECMA-262 11.2 White Space - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; + function isWhiteSpace(ch) { + return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } + // ECMA-262 11.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); } - } - return this; -}; + // ECMA-262 11.6 Identifier Names and Identifiers -EventEmitter.prototype.on = EventEmitter.prototype.addListener; + function fromCodePoint(cp) { + return (cp < 0x10000) ? String.fromCharCode(cp) : + String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) + + String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023)); + } -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + function isIdentifierStart(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch))); + } - var fired = false; + function isIdentifierPart(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch >= 0x30 && ch <= 0x39) || // 0..9 + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch))); + } - function g() { - this.removeListener(type, g); + // ECMA-262 11.6.2.2 Future Reserved Words - if (!fired) { - fired = true; - listener.apply(this, arguments); + function isFutureReservedWord(id) { + switch (id) { + case 'enum': + case 'export': + case 'import': + case 'super': + return true; + default: + return false; + } } - } - g.listener = listener; - this.on(type, g); + function isStrictModeReservedWord(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'yield': + case 'let': + return true; + default: + return false; + } + } - return this; -}; + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; + // ECMA-262 11.6.2.1 Keywords - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + function isKeyword(id) { + switch (id.length) { + case 2: + return (id === 'if') || (id === 'in') || (id === 'do'); + case 3: + return (id === 'var') || (id === 'for') || (id === 'new') || + (id === 'try') || (id === 'let'); + case 4: + return (id === 'this') || (id === 'else') || (id === 'case') || + (id === 'void') || (id === 'with') || (id === 'enum'); + case 5: + return (id === 'while') || (id === 'break') || (id === 'catch') || + (id === 'throw') || (id === 'const') || (id === 'yield') || + (id === 'class') || (id === 'super'); + case 6: + return (id === 'return') || (id === 'typeof') || (id === 'delete') || + (id === 'switch') || (id === 'export') || (id === 'import'); + case 7: + return (id === 'default') || (id === 'finally') || (id === 'extends'); + case 8: + return (id === 'function') || (id === 'continue') || (id === 'debugger'); + case 10: + return (id === 'instanceof'); + default: + return false; + } + } - if (!this._events || !this._events[type]) - return this; + // ECMA-262 11.4 Comments - list = this._events[type]; - length = list.length; - position = -1; + function addComment(type, value, start, end, loc) { + var comment; - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); + assert(typeof start === 'number', 'Comment must have valid position'); - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } + state.lastCommentStart = start; + + comment = { + type: type, + value: value + }; + if (extra.range) { + comment.range = [start, end]; + } + if (extra.loc) { + comment.loc = loc; + } + extra.comments.push(comment); + if (extra.attachComment) { + extra.leadingComments.push(comment); + extra.trailingComments.push(comment); + } + if (extra.tokenize) { + comment.type = comment.type + 'Comment'; + if (extra.delegate) { + comment = extra.delegate(comment); + } + extra.tokens.push(comment); + } } - if (position < 0) - return this; + function skipSingleLineComment(offset) { + var start, loc, ch, comment; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } + start = index - offset; + loc = { + start: { + line: lineNumber, + column: index - lineStart - offset + } + }; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } + while (index < length) { + ch = source.charCodeAt(index); + ++index; + if (isLineTerminator(ch)) { + hasLineTerminator = true; + if (extra.comments) { + comment = source.slice(start + offset, index - 1); + loc.end = { + line: lineNumber, + column: index - lineStart - 1 + }; + addComment('Line', comment, start, index - 1, loc); + } + if (ch === 13 && source.charCodeAt(index) === 10) { + ++index; + } + ++lineNumber; + lineStart = index; + return; + } + } - return this; -}; + if (extra.comments) { + comment = source.slice(start + offset, index); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Line', comment, start, index, loc); + } + } -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; + function skipMultiLineComment() { + var start, loc, ch, comment; - if (!this._events) - return this; + if (extra.comments) { + start = index - 2; + loc = { + start: { + line: lineNumber, + column: index - lineStart - 2 + } + }; + } - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } + while (index < length) { + ch = source.charCodeAt(index); + if (isLineTerminator(ch)) { + if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) { + ++index; + } + hasLineTerminator = true; + ++lineNumber; + ++index; + lineStart = index; + } else if (ch === 0x2A) { + // Block comment ends with '*/'. + if (source.charCodeAt(index + 1) === 0x2F) { + ++index; + ++index; + if (extra.comments) { + comment = source.slice(start + 2, index - 2); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Block', comment, start, index, loc); + } + return; + } + ++index; + } else { + ++index; + } + } - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); + // Ran off the end of the file - the whole thing is a comment + if (extra.comments) { + loc.end = { + line: lineNumber, + column: index - lineStart + }; + comment = source.slice(start + 2, index); + addComment('Block', comment, start, index, loc); + } + tolerateUnexpectedToken(); } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - listeners = this._events[type]; + function skipComment() { + var ch, start; + hasLineTerminator = false; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; + start = (index === 0); + while (index < length) { + ch = source.charCodeAt(index); - return this; -}; + if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + hasLineTerminator = true; + ++index; + if (ch === 0x0D && source.charCodeAt(index) === 0x0A) { + ++index; + } + ++lineNumber; + lineStart = index; + start = true; + } else if (ch === 0x2F) { // U+002F is '/' + ch = source.charCodeAt(index + 1); + if (ch === 0x2F) { + ++index; + ++index; + skipSingleLineComment(2); + start = true; + } else if (ch === 0x2A) { // U+002A is '*' + ++index; + ++index; + skipMultiLineComment(); + } else { + break; + } + } else if (start && ch === 0x2D) { // U+002D is '-' + // U+003E is '>' + if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) { + // '-->' is a single-line comment + index += 3; + skipSingleLineComment(3); + } else { + break; + } + } else if (ch === 0x3C) { // U+003C is '<' + if (source.slice(index + 1, index + 4) === '!--') { + ++index; // `<` + ++index; // `!` + ++index; // `-` + ++index; // `-` + skipSingleLineComment(4); + } else { + break; + } + } else { + break; + } + } + } -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; + function scanHexEscape(prefix) { + var i, len, ch, code = 0; -EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && isHexDigit(source[index])) { + ch = source[index++]; + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; - } - return 0; -}; + function scanUnicodeCodePointEscape() { + var ch, code; -EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); -}; + ch = source[index]; + code = 0; -function isFunction(arg) { - return typeof arg === 'function'; -} + // At least, one hex digit is required. + if (ch === '}') { + throwUnexpectedToken(); + } -function isNumber(arg) { - return typeof arg === 'number'; -} + while (index < length) { + ch = source[index++]; + if (!isHexDigit(ch)) { + break; + } + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} + if (code > 0x10FFFF || ch !== '}') { + throwUnexpectedToken(); + } -function isUndefined(arg) { - return arg === void 0; -} + return fromCodePoint(code); + } -},{}],18:[function(require,module,exports){ -var http = require('http'); + function codePointAt(i) { + var cp, first, second; -var https = module.exports; + cp = source.charCodeAt(i); + if (cp >= 0xD800 && cp <= 0xDBFF) { + second = source.charCodeAt(i + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + first = cp; + cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } -for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key]; -}; + return cp; + } -https.request = function (params, cb) { - if (!params) params = {}; - params.scheme = 'https'; - params.protocol = 'https:'; - return http.request.call(this, params, cb); -} + function getComplexIdentifier() { + var cp, ch, id; -},{"http":94}],19:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d + cp = codePointAt(index); + id = fromCodePoint(cp); + index += id.length; - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + // '\u' (U+005C, U+0075) denotes an escaped character. + if (cp === 0x5C) { + if (source.charCodeAt(index) !== 0x75) { + throwUnexpectedToken(); + } + ++index; + if (source[index] === '{') { + ++index; + ch = scanUnicodeCodePointEscape(); + } else { + ch = scanHexEscape('u'); + cp = ch.charCodeAt(0); + if (!ch || ch === '\\' || !isIdentifierStart(cp)) { + throwUnexpectedToken(); + } + } + id = ch; + } - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + while (index < length) { + cp = codePointAt(index); + if (!isIdentifierPart(cp)) { + break; + } + ch = fromCodePoint(cp); + id += ch; + index += ch.length; + + // '\u' (U+005C, U+0075) denotes an escaped character. + if (cp === 0x5C) { + id = id.substr(0, id.length - 1); + if (source.charCodeAt(index) !== 0x75) { + throwUnexpectedToken(); + } + ++index; + if (source[index] === '{') { + ++index; + ch = scanUnicodeCodePointEscape(); + } else { + ch = scanHexEscape('u'); + cp = ch.charCodeAt(0); + if (!ch || ch === '\\' || !isIdentifierPart(cp)) { + throwUnexpectedToken(); + } + } + id += ch; + } + } - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} + return id; + } -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + function getIdentifier() { + var start, ch; - value = Math.abs(value) + start = index++; + while (index < length) { + ch = source.charCodeAt(index); + if (ch === 0x5C) { + // Blackslash (U+005C) marks Unicode escape sequence. + index = start; + return getComplexIdentifier(); + } else if (ch >= 0xD800 && ch < 0xDFFF) { + // Need to handle surrogate pairs. + index = start; + return getComplexIdentifier(); + } + if (isIdentifierPart(ch)) { + ++index; + } else { + break; + } + } - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 + return source.slice(start, index); } - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } + function scanIdentifier() { + var start, id, type; - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + start = index; - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + // Backslash (U+005C) starts an escaped character. + id = (source.charCodeAt(index) === 0x5C) ? getComplexIdentifier() : getIdentifier(); - buffer[offset + i - d] |= s * 128 -} + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + type = Token.Identifier; + } else if (isKeyword(id)) { + type = Token.Keyword; + } else if (id === 'null') { + type = Token.NullLiteral; + } else if (id === 'true' || id === 'false') { + type = Token.BooleanLiteral; + } else { + type = Token.Identifier; + } -},{}],20:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} + return { + type: type, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } -},{}],21:[function(require,module,exports){ -/** - * Determine if an object is Buffer - * - * Author: Feross Aboukhadijeh - * License: MIT - * - * `npm install is-buffer` - */ -module.exports = function (obj) { - return !!(obj != null && - (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - (obj.constructor && - typeof obj.constructor.isBuffer === 'function' && - obj.constructor.isBuffer(obj)) - )) -} + // ECMA-262 11.7 Punctuators -},{}],22:[function(require,module,exports){ -var toString = {}.toString; + function scanPunctuator() { + var token, str; -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; + token = { + type: Token.Punctuator, + value: '', + lineNumber: lineNumber, + lineStart: lineStart, + start: index, + end: index + }; -},{}],23:[function(require,module,exports){ -'use strict'; + // Check for most common single-character punctuators. + str = source[index]; + switch (str) { + case '(': + if (extra.tokenize) { + extra.openParenToken = extra.tokenValues.length; + } + ++index; + break; -var yaml = require('./lib/js-yaml.js'); + case '{': + if (extra.tokenize) { + extra.openCurlyToken = extra.tokenValues.length; + } + state.curlyStack.push('{'); + ++index; + break; + case '.': + ++index; + if (source[index] === '.' && source[index + 1] === '.') { + // Spread operator: ... + index += 2; + str = '...'; + } + break; -module.exports = yaml; + case '}': + ++index; + state.curlyStack.pop(); + break; + case ')': + case ';': + case ',': + case '[': + case ']': + case ':': + case '?': + case '~': + ++index; + break; -},{"./lib/js-yaml.js":24}],24:[function(require,module,exports){ -'use strict'; + default: + // 4-character punctuator. + str = source.substr(index, 4); + if (str === '>>>=') { + index += 4; + } else { + // 3-character punctuators. + str = str.substr(0, 3); + if (str === '===' || str === '!==' || str === '>>>' || + str === '<<=' || str === '>>=') { + index += 3; + } else { -var loader = require('./js-yaml/loader'); -var dumper = require('./js-yaml/dumper'); + // 2-character punctuators. + str = str.substr(0, 2); + if (str === '&&' || str === '||' || str === '==' || str === '!=' || + str === '+=' || str === '-=' || str === '*=' || str === '/=' || + str === '++' || str === '--' || str === '<<' || str === '>>' || + str === '&=' || str === '|=' || str === '^=' || str === '%=' || + str === '<=' || str === '>=' || str === '=>') { + index += 2; + } else { + // 1-character punctuators. + str = source[index]; + if ('<>=!+-*%&|^/'.indexOf(str) >= 0) { + ++index; + } + } + } + } + } -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; -} + if (index === token.start) { + throwUnexpectedToken(); + } + token.end = index; + token.value = str; + return token; + } -module.exports.Type = require('./js-yaml/type'); -module.exports.Schema = require('./js-yaml/schema'); -module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe'); -module.exports.JSON_SCHEMA = require('./js-yaml/schema/json'); -module.exports.CORE_SCHEMA = require('./js-yaml/schema/core'); -module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); -module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full'); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.safeLoad = loader.safeLoad; -module.exports.safeLoadAll = loader.safeLoadAll; -module.exports.dump = dumper.dump; -module.exports.safeDump = dumper.safeDump; -module.exports.YAMLException = require('./js-yaml/exception'); + // ECMA-262 11.8.3 Numeric Literals -// Deprecated schema names from JS-YAML 2.0.x -module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe'); -module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); -module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full'); + function scanHexLiteral(start) { + var number = ''; -// Deprecated functions from JS-YAML 1.x.x -module.exports.scan = deprecated('scan'); -module.exports.parse = deprecated('parse'); -module.exports.compose = deprecated('compose'); -module.exports.addConstructor = deprecated('addConstructor'); + while (index < length) { + if (!isHexDigit(source[index])) { + break; + } + number += source[index++]; + } -},{"./js-yaml/dumper":26,"./js-yaml/exception":27,"./js-yaml/loader":28,"./js-yaml/schema":30,"./js-yaml/schema/core":31,"./js-yaml/schema/default_full":32,"./js-yaml/schema/default_safe":33,"./js-yaml/schema/failsafe":34,"./js-yaml/schema/json":35,"./js-yaml/type":36}],25:[function(require,module,exports){ -'use strict'; + if (number.length === 0) { + throwUnexpectedToken(); + } + if (isIdentifierStart(source.charCodeAt(index))) { + throwUnexpectedToken(); + } -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); -} + return { + type: Token.NumericLiteral, + value: parseInt('0x' + number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + function scanBinaryLiteral(start) { + var ch, number; -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); -} + number = ''; + while (index < length) { + ch = source[index]; + if (ch !== '0' && ch !== '1') { + break; + } + number += source[index++]; + } -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; + if (number.length === 0) { + // only 0b or 0B + throwUnexpectedToken(); + } - return [ sequence ]; -} + if (index < length) { + ch = source.charCodeAt(index); + /* istanbul ignore else */ + if (isIdentifierStart(ch) || isDecimalDigit(ch)) { + throwUnexpectedToken(); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 2), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } -function extend(target, source) { - var index, length, key, sourceKeys; + function scanOctalLiteral(prefix, start) { + var number, octal; - if (source) { - sourceKeys = Object.keys(source); + if (isOctalDigit(prefix)) { + octal = true; + number = '0' + source[index++]; + } else { + octal = false; + ++index; + number = ''; + } - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } - } + while (index < length) { + if (!isOctalDigit(source[index])) { + break; + } + number += source[index++]; + } - return target; -} + if (!octal && number.length === 0) { + // only 0o or 0O + throwUnexpectedToken(); + } + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwUnexpectedToken(); + } -function repeat(string, count) { - var result = '', cycle; + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } - for (cycle = 0; cycle < count; cycle += 1) { - result += string; - } + function isImplicitOctalLiteral() { + var i, ch; - return result; -} + // Implicit octal, unless there is a non-octal digit. + // (Annex B.1.1 on Numeric Literals) + for (i = index + 1; i < length; ++i) { + ch = source[i]; + if (ch === '8' || ch === '9') { + return false; + } + if (!isOctalDigit(ch)) { + return true; + } + } + return true; + } -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); -} + function scanNumericLiteral() { + var number, start, ch; + ch = source[index]; + assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), + 'Numeric literal must start with a decimal digit or a decimal point'); -module.exports.isNothing = isNothing; -module.exports.isObject = isObject; -module.exports.toArray = toArray; -module.exports.repeat = repeat; -module.exports.isNegativeZero = isNegativeZero; -module.exports.extend = extend; + start = index; + number = ''; + if (ch !== '.') { + number = source[index++]; + ch = source[index]; -},{}],26:[function(require,module,exports){ -'use strict'; + // Hex number starts with '0x'. + // Octal number starts with '0'. + // Octal number in ES6 starts with '0o'. + // Binary number in ES6 starts with '0b'. + if (number === '0') { + if (ch === 'x' || ch === 'X') { + ++index; + return scanHexLiteral(start); + } + if (ch === 'b' || ch === 'B') { + ++index; + return scanBinaryLiteral(start); + } + if (ch === 'o' || ch === 'O') { + return scanOctalLiteral(ch, start); + } -/*eslint-disable no-use-before-define*/ + if (isOctalDigit(ch)) { + if (isImplicitOctalLiteral()) { + return scanOctalLiteral(ch, start); + } + } + } -var common = require('./common'); -var YAMLException = require('./exception'); -var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); -var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; + if (ch === '.') { + number += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + if (ch === 'e' || ch === 'E') { + number += source[index++]; -var ESCAPE_SEQUENCES = {}; + ch = source[index]; + if (ch === '+' || ch === '-') { + number += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + } else { + throwUnexpectedToken(); + } + } -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; + if (isIdentifierStart(source.charCodeAt(index))) { + throwUnexpectedToken(); + } -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; + // ECMA-262 11.8.4 String Literals - if (map === null) return {}; + function scanStringLiteral() { + var str = '', quote, start, ch, unescaped, octToDec, octal = false; - result = {}; - keys = Object.keys(map); + quote = source[index]; + assert((quote === '\'' || quote === '"'), + 'String literal must starts with a quote'); - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); + start = index; + ++index; - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } + while (index < length) { + ch = source[index++]; - type = schema.compiledTypeMap[tag]; + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = source[index++]; + if (!ch || !isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'u': + case 'x': + if (source[index] === '{') { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + unescaped = scanHexEscape(ch); + if (!unescaped) { + throw throwUnexpectedToken(); + } + str += unescaped; + } + break; + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\x0B'; + break; + case '8': + case '9': + str += ch; + tolerateUnexpectedToken(); + break; + + default: + if (isOctalDigit(ch)) { + octToDec = octalToDecimal(ch); + + octal = octToDec.octal || octal; + str += String.fromCharCode(octToDec.code); + } else { + str += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + } + } else if (isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; + if (quote !== '') { + throwUnexpectedToken(); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + lineNumber: startLineNumber, + lineStart: startLineStart, + start: start, + end: index + }; } - result[tag] = style; - } + // ECMA-262 11.8.6 Template Literal Lexical Components - return result; -} + function scanTemplate() { + var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped; -function encodeHex(character) { - var string, handle, length; + terminated = false; + tail = false; + start = index; + head = (source[index] === '`'); + rawOffset = 2; - string = character.toString(16).toUpperCase(); + ++index; - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); - } + while (index < length) { + ch = source[index++]; + if (ch === '`') { + rawOffset = 1; + tail = true; + terminated = true; + break; + } else if (ch === '$') { + if (source[index] === '{') { + state.curlyStack.push('${'); + ++index; + terminated = true; + break; + } + cooked += ch; + } else if (ch === '\\') { + ch = source[index++]; + if (!isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + cooked += '\n'; + break; + case 'r': + cooked += '\r'; + break; + case 't': + cooked += '\t'; + break; + case 'u': + case 'x': + if (source[index] === '{') { + ++index; + cooked += scanUnicodeCodePointEscape(); + } else { + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + cooked += unescaped; + } else { + index = restore; + cooked += ch; + } + } + break; + case 'b': + cooked += '\b'; + break; + case 'f': + cooked += '\f'; + break; + case 'v': + cooked += '\v'; + break; + + default: + if (ch === '0') { + if (isDecimalDigit(source.charCodeAt(index))) { + // Illegal: \01 \02 and so on + throwError(Messages.TemplateOctalLiteral); + } + cooked += '\0'; + } else if (isOctalDigit(ch)) { + // Illegal: \1 \2 + throwError(Messages.TemplateOctalLiteral); + } else { + cooked += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + } + } else if (isLineTerminator(ch.charCodeAt(0))) { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + cooked += '\n'; + } else { + cooked += ch; + } + } - return '\\' + handle + common.repeat('0', length - string.length) + string; -} + if (!terminated) { + throwUnexpectedToken(); + } -function State(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; + if (!head) { + state.curlyStack.pop(); + } - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; + return { + type: Token.Template, + value: { + cooked: cooked, + raw: source.slice(start + 1, index - rawOffset) + }, + head: head, + tail: tail, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } - this.tag = null; - this.result = ''; + // ECMA-262 11.8.5 Regular Expression Literals + + function testRegExp(pattern, flags) { + // The BMP character to use as a replacement for astral symbols when + // translating an ES6 "u"-flagged pattern to an ES5-compatible + // approximation. + // Note: replacing with '\uFFFF' enables false positives in unlikely + // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid + // pattern that would not be detected by this substitution. + var astralSubstitute = '\uFFFF', + tmp = pattern; + + if (flags.indexOf('u') >= 0) { + tmp = tmp + // Replace every Unicode escape sequence with the equivalent + // BMP character or a constant ASCII code point in the case of + // astral symbols. (See the above note on `astralSubstitute` + // for more information.) + .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) { + var codePoint = parseInt($1 || $2, 16); + if (codePoint > 0x10FFFF) { + throwUnexpectedToken(null, Messages.InvalidRegExp); + } + if (codePoint <= 0xFFFF) { + return String.fromCharCode(codePoint); + } + return astralSubstitute; + }) + // Replace each paired surrogate with a single ASCII symbol to + // avoid throwing on regular expressions that are only valid in + // combination with the "u" flag. + .replace( + /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + astralSubstitute + ); + } + + // First, detect invalid regular expressions. + try { + RegExp(tmp); + } catch (e) { + throwUnexpectedToken(null, Messages.InvalidRegExp); + } - this.duplicates = []; - this.usedDuplicates = null; -} + // Return a regular expression object for this pattern-flag pair, or + // `null` in case the current environment doesn't support the flags it + // uses. + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; + function scanRegExpBody() { + var ch, str, classMarker, terminated, body; - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } + ch = source[index]; + assert(ch === '/', 'Regular expression literal must start with a slash'); + str = source[index++]; - if (line.length && line !== '\n') result += ind; + classMarker = false; + terminated = false; + while (index < length) { + ch = source[index++]; + str += ch; + if (ch === '\\') { + ch = source[index++]; + // ECMA-262 7.8.5 + if (isLineTerminator(ch.charCodeAt(0))) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } + str += ch; + } else if (isLineTerminator(ch.charCodeAt(0))) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } else if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } else { + if (ch === '/') { + terminated = true; + break; + } else if (ch === '[') { + classMarker = true; + } + } + } - result += line; - } + if (!terminated) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } - return result; -} + // Exclude leading and trailing slash. + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} + function scanRegExpFlags() { + var ch, str, flags, restore; -function testImplicitResolving(state, str) { - var index, length, type; + str = ''; + flags = ''; + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch.charCodeAt(0))) { + break; + } - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; + ++index; + if (ch === '\\' && index < length) { + ch = source[index]; + if (ch === 'u') { + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + flags += ch; + for (str += '\\u'; restore < index; ++restore) { + str += source[restore]; + } + } else { + index = restore; + flags += 'u'; + str += '\\u'; + } + tolerateUnexpectedToken(); + } else { + str += '\\'; + tolerateUnexpectedToken(); + } + } else { + flags += ch; + str += ch; + } + } - if (type.resolve(str)) { - return true; + return { + value: flags, + literal: str + }; } - } - return false; -} + function scanRegExp() { + var start, body, flags, value; + scanning = true; + + lookahead = null; + skipComment(); + start = index; + + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value = testRegExp(body.value, flags.value); + scanning = false; + if (extra.tokenize) { + return { + type: Token.RegularExpression, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + return { + literal: body.literal + flags.literal, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + start: start, + end: index + }; + } -function StringBuilder(source) { - this.source = source; - this.result = ''; - this.checkpoint = 0; -} + function collectRegex() { + var pos, loc, regex, token; -StringBuilder.prototype.takeUpTo = function (position) { - var er; + skipComment(); - if (position < this.checkpoint) { - er = new Error('position should be > checkpoint'); - er.position = position; - er.checkpoint = this.checkpoint; - throw er; - } + pos = index; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; - this.result += this.source.slice(this.checkpoint, position); - this.checkpoint = position; - return this; -}; + regex = scanRegExp(); -StringBuilder.prototype.escapeChar = function () { - var character, esc; + loc.end = { + line: lineNumber, + column: index - lineStart + }; - character = this.source.charCodeAt(this.checkpoint); - esc = ESCAPE_SEQUENCES[character] || encodeHex(character); - this.result += esc; - this.checkpoint += 1; + /* istanbul ignore next */ + if (!extra.tokenize) { + // Pop the previous token, which is likely '/' or '/=' + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === 'Punctuator') { + if (token.value === '/' || token.value === '/=') { + extra.tokens.pop(); + } + } + } - return this; -}; + extra.tokens.push({ + type: 'RegularExpression', + value: regex.literal, + regex: regex.regex, + range: [pos, index], + loc: loc + }); + } -StringBuilder.prototype.finish = function () { - if (this.source.length > this.checkpoint) { - this.takeUpTo(this.source.length); - } -}; + return regex; + } -function writeScalar(state, object, level, iskey) { - var simple, first, spaceWrap, folded, literal, single, double, - sawLineFeed, linePosition, longestLine, indent, max, character, - position, escapeSeq, hexEsc, previous, lineLength, modifier, - trailingLineBreaks, result; + function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; + } - if (object.length === 0) { - state.dump = "''"; - return; - } + // Using the following algorithm: + // https://github.com/mozilla/sweet.js/wiki/design - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(object) !== -1) { - state.dump = "'" + object + "'"; - return; - } + function advanceSlash() { + var regex, previous, check; - simple = true; - first = object.length ? object.charCodeAt(0) : 0; - spaceWrap = (CHAR_SPACE === first || - CHAR_SPACE === object.charCodeAt(object.length - 1)); - - // Simplified check for restricted first characters - // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29 - if (CHAR_MINUS === first || - CHAR_QUESTION === first || - CHAR_COMMERCIAL_AT === first || - CHAR_GRAVE_ACCENT === first) { - simple = false; - } - - // Can only use > and | if not wrapped in spaces or is not a key. - // Also, don't use if in flow mode. - if (spaceWrap || (state.flowLevel > -1 && state.flowLevel <= level)) { - if (spaceWrap) simple = false; - - folded = false; - literal = false; - } else { - folded = !iskey; - literal = !iskey; - } - - single = true; - double = new StringBuilder(object); + function testKeyword(value) { + return value && (value.length > 1) && (value[0] >= 'a') && (value[0] <= 'z'); + } - sawLineFeed = false; - linePosition = 0; - longestLine = 0; + previous = extra.tokenValues[extra.tokens.length - 1]; + regex = (previous !== null); - indent = state.indent * level; - max = state.lineWidth; + switch (previous) { + case 'this': + case ']': + regex = false; + break; - // Replace -1 with biggest ingeger number according to - // http://ecma262-5.com/ELS5_HTML.htm#Section_8.5 - if (max === -1) max = 9007199254740991; + case ')': + check = extra.tokenValues[extra.openParenToken - 1]; + regex = (check === 'if' || check === 'while' || check === 'for' || check === 'with'); + break; - if (indent < 40) max -= indent; - else max = 40; + case '}': + // Dividing a function by anything makes little sense, + // but we have to check for that. + regex = false; + if (testKeyword(extra.tokenValues[extra.openCurlyToken - 3])) { + // Anonymous function, e.g. function(){} /42 + check = extra.tokenValues[extra.openCurlyToken - 4]; + regex = check ? (FnExprTokens.indexOf(check) < 0) : false; + } else if (testKeyword(extra.tokenValues[extra.openCurlyToken - 4])) { + // Named function, e.g. function f(){} /42/ + check = extra.tokenValues[extra.openCurlyToken - 5]; + regex = check ? (FnExprTokens.indexOf(check) < 0) : true; + } + } - for (position = 0; position < object.length; position++) { - character = object.charCodeAt(position); - if (simple) { - // Characters that can never appear in the simple scalar - if (!simpleChar(character)) { - simple = false; - } else { - // Still simple. If we make it all the way through like - // this, then we can just dump the string as-is. - continue; - } + return regex ? collectRegex() : scanPunctuator(); } - if (single && character === CHAR_SINGLE_QUOTE) { - single = false; - } + function advance() { + var cp, token; - escapeSeq = ESCAPE_SEQUENCES[character]; - hexEsc = needsHexEscape(character); + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + start: index, + end: index + }; + } - if (!escapeSeq && !hexEsc) { - continue; - } + cp = source.charCodeAt(index); - if (character !== CHAR_LINE_FEED && - character !== CHAR_DOUBLE_QUOTE && - character !== CHAR_SINGLE_QUOTE) { - folded = false; - literal = false; - } else if (character === CHAR_LINE_FEED) { - sawLineFeed = true; - single = false; - if (position > 0) { - previous = object.charCodeAt(position - 1); - if (previous === CHAR_SPACE) { - literal = false; - folded = false; + if (isIdentifierStart(cp)) { + token = scanIdentifier(); + if (strict && isStrictModeReservedWord(token.value)) { + token.type = Token.Keyword; + } + return token; } - } - if (folded) { - lineLength = position - linePosition; - linePosition = position; - if (lineLength > longestLine) longestLine = lineLength; - } - } - if (character !== CHAR_DOUBLE_QUOTE) single = false; + // Very common: ( and ) and ; + if (cp === 0x28 || cp === 0x29 || cp === 0x3B) { + return scanPunctuator(); + } - double.takeUpTo(position); - double.escapeChar(); - } + // String literal starts with single quote (U+0027) or double quote (U+0022). + if (cp === 0x27 || cp === 0x22) { + return scanStringLiteral(); + } - if (simple && testImplicitResolving(state, object)) simple = false; + // Dot (.) U+002E can also start a floating-point number, hence the need + // to check the next character. + if (cp === 0x2E) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } - modifier = ''; - if (folded || literal) { - trailingLineBreaks = 0; - if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) { - trailingLineBreaks += 1; - if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) { - trailingLineBreaks += 1; - } - } + if (isDecimalDigit(cp)) { + return scanNumericLiteral(); + } - if (trailingLineBreaks === 0) modifier = '-'; - else if (trailingLineBreaks === 2) modifier = '+'; - } + // Slash (/) U+002F can also start a regex. + if (extra.tokenize && cp === 0x2F) { + return advanceSlash(); + } - if (literal && longestLine < max || state.tag !== null) { - folded = false; - } + // Template literals start with ` (U+0060) for template head + // or } (U+007D) for template middle or template tail. + if (cp === 0x60 || (cp === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) { + return scanTemplate(); + } - // If it's literally one line, then don't bother with the literal. - // We may still want to do a fold, though, if it's a super long line. - if (!sawLineFeed) literal = false; + // Possible identifier start in a surrogate pair. + if (cp >= 0xD800 && cp < 0xDFFF) { + cp = codePointAt(index); + if (isIdentifierStart(cp)) { + return scanIdentifier(); + } + } - if (simple) { - state.dump = object; - } else if (single) { - state.dump = '\'' + object + '\''; - } else if (folded) { - result = fold(object, max); - state.dump = '>' + modifier + '\n' + indentString(result, indent); - } else if (literal) { - if (!modifier) object = object.replace(/\n$/, ''); - state.dump = '|' + modifier + '\n' + indentString(object, indent); - } else if (double) { - double.finish(); - state.dump = '"' + double.result + '"'; - } else { - throw new Error('Failed to dump scalar value'); - } + return scanPunctuator(); + } - return; -} + function collectToken() { + var loc, token, value, entry; -// The `trailing` var is a regexp match of any trailing `\n` characters. -// -// There are three cases we care about: -// -// 1. One trailing `\n` on the string. Just use `|` or `>`. -// This is the assumed default. (trailing = null) -// 2. No trailing `\n` on the string. Use `|-` or `>-` to "chomp" the end. -// 3. More than one trailing `\n` on the string. Use `|+` or `>+`. -// -// In the case of `>+`, these line breaks are *not* doubled (like the line -// breaks within the string), so it's important to only end with the exact -// same number as we started. -function fold(object, max) { - var result = '', - position = 0, - length = object.length, - trailing = /\n+$/.exec(object), - newLine; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; - if (trailing) { - length = trailing.index + 1; - } + token = advance(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; - while (position < length) { - newLine = object.indexOf('\n', position); - if (newLine > length || newLine === -1) { - if (result) result += '\n\n'; - result += foldLine(object.slice(position, length), max); - position = length; + if (token.type !== Token.EOF) { + value = source.slice(token.start, token.end); + entry = { + type: TokenName[token.type], + value: value, + range: [token.start, token.end], + loc: loc + }; + if (token.regex) { + entry.regex = { + pattern: token.regex.pattern, + flags: token.regex.flags + }; + } + if (extra.tokenValues) { + extra.tokenValues.push((entry.type === 'Punctuator' || entry.type === 'Keyword') ? entry.value : null); + } + if (extra.tokenize) { + if (!extra.range) { + delete entry.range; + } + if (!extra.loc) { + delete entry.loc; + } + if (extra.delegate) { + entry = extra.delegate(entry); + } + } + extra.tokens.push(entry); + } - } else { - if (result) result += '\n\n'; - result += foldLine(object.slice(position, newLine), max); - position = newLine + 1; + return token; } - } - if (trailing && trailing[0] !== '\n') result += trailing[0]; - - return result; -} + function lex() { + var token; + scanning = true; -function foldLine(line, max) { - if (line === '') return line; + lastIndex = index; + lastLineNumber = lineNumber; + lastLineStart = lineStart; - var foldRe = /[^\s] [^\s]/g, - result = '', - prevMatch = 0, - foldStart = 0, - match = foldRe.exec(line), - index, - foldEnd, - folded; + skipComment(); - while (match) { - index = match.index; + token = lookahead; - // when we cross the max len, if the previous match would've - // been ok, use that one, and carry on. If there was no previous - // match on this fold section, then just have a long line. - if (index - foldStart > max) { - if (prevMatch !== foldStart) foldEnd = prevMatch; - else foldEnd = index; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; - if (result) result += '\n'; - folded = line.slice(foldStart, foldEnd); - result += folded; - foldStart = foldEnd + 1; + lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); + scanning = false; + return token; } - prevMatch = index + 1; - match = foldRe.exec(line); - } - if (result) result += '\n'; + function peek() { + scanning = true; - // if we end up with one last word at the end, then the last bit might - // be slightly bigger than we wanted, because we exited out of the loop. - if (foldStart !== prevMatch && line.length - foldStart > max) { - result += line.slice(foldStart, prevMatch) + '\n' + - line.slice(prevMatch + 1); - } else { - result += line.slice(foldStart); - } + skipComment(); - return result; -} + lastIndex = index; + lastLineNumber = lineNumber; + lastLineStart = lineStart; -// Returns true if character can be found in a simple scalar -function simpleChar(character) { - return CHAR_TAB !== character && - CHAR_LINE_FEED !== character && - CHAR_CARRIAGE_RETURN !== character && - CHAR_COMMA !== character && - CHAR_LEFT_SQUARE_BRACKET !== character && - CHAR_RIGHT_SQUARE_BRACKET !== character && - CHAR_LEFT_CURLY_BRACKET !== character && - CHAR_RIGHT_CURLY_BRACKET !== character && - CHAR_SHARP !== character && - CHAR_AMPERSAND !== character && - CHAR_ASTERISK !== character && - CHAR_EXCLAMATION !== character && - CHAR_VERTICAL_LINE !== character && - CHAR_GREATER_THAN !== character && - CHAR_SINGLE_QUOTE !== character && - CHAR_DOUBLE_QUOTE !== character && - CHAR_PERCENT !== character && - CHAR_COLON !== character && - !ESCAPE_SEQUENCES[character] && - !needsHexEscape(character); -} + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; -// Returns true if the character code needs to be escaped. -function needsHexEscape(character) { - return !((0x00020 <= character && character <= 0x00007E) || - (character === 0x00085) || - (0x000A0 <= character && character <= 0x00D7FF) || - (0x0E000 <= character && character <= 0x00FFFD) || - (0x10000 <= character && character <= 0x10FFFF)); -} + lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); + scanning = false; + } -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; + function Position() { + this.line = startLineNumber; + this.column = startIndex - startLineStart; + } - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ', '; - _result += state.dump; + function SourceLocation() { + this.start = new Position(); + this.end = null; } - } - state.tag = _tag; - state.dump = '[' + _result + ']'; -} + function WrappingSourceLocation(startToken) { + this.start = { + line: startToken.lineNumber, + column: startToken.start - startToken.lineStart + }; + this.end = null; + } -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; + function Node() { + if (extra.range) { + this.range = [startIndex, 0]; + } + if (extra.loc) { + this.loc = new SourceLocation(); + } + } - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); - } - _result += '- ' + state.dump; + function WrappingNode(startToken) { + if (extra.range) { + this.range = [startToken.start, 0]; + } + if (extra.loc) { + this.loc = new WrappingSourceLocation(startToken); + } } - } - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} + WrappingNode.prototype = Node.prototype = { -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; + processComment: function () { + var lastChild, + innerComments, + leadingComments, + trailingComments, + bottomRight = extra.bottomRightStack, + i, + comment, + last = bottomRight[bottomRight.length - 1]; - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; + if (this.type === Syntax.Program) { + if (this.body.length > 0) { + return; + } + } + /** + * patch innnerComments for properties empty block + * `function a() {/** comments **\/}` + */ + + if (this.type === Syntax.BlockStatement && this.body.length === 0) { + innerComments = []; + for (i = extra.leadingComments.length - 1; i >= 0; --i) { + comment = extra.leadingComments[i]; + if (this.range[1] >= comment.range[1]) { + innerComments.unshift(comment); + extra.leadingComments.splice(i, 1); + extra.trailingComments.splice(i, 1); + } + } + if (innerComments.length) { + this.innerComments = innerComments; + //bottomRight.push(this); + return; + } + } - if (index !== 0) pairBuffer += ', '; + if (extra.trailingComments.length > 0) { + trailingComments = []; + for (i = extra.trailingComments.length - 1; i >= 0; --i) { + comment = extra.trailingComments[i]; + if (comment.range[0] >= this.range[1]) { + trailingComments.unshift(comment); + extra.trailingComments.splice(i, 1); + } + } + extra.trailingComments = []; + } else { + if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) { + trailingComments = last.trailingComments; + delete last.trailingComments; + } + } - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + // Eating the stack. + while (last && last.range[0] >= this.range[0]) { + lastChild = bottomRight.pop(); + last = bottomRight[bottomRight.length - 1]; + } - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } + if (lastChild) { + if (lastChild.leadingComments) { + leadingComments = []; + for (i = lastChild.leadingComments.length - 1; i >= 0; --i) { + comment = lastChild.leadingComments[i]; + if (comment.range[1] <= this.range[0]) { + leadingComments.unshift(comment); + lastChild.leadingComments.splice(i, 1); + } + } - if (state.dump.length > 1024) pairBuffer += '? '; + if (!lastChild.leadingComments.length) { + lastChild.leadingComments = undefined; + } + } + } else if (extra.leadingComments.length > 0) { + leadingComments = []; + for (i = extra.leadingComments.length - 1; i >= 0; --i) { + comment = extra.leadingComments[i]; + if (comment.range[1] <= this.range[0]) { + leadingComments.unshift(comment); + extra.leadingComments.splice(i, 1); + } + } + } - pairBuffer += state.dump + ': '; - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } + if (leadingComments && leadingComments.length > 0) { + this.leadingComments = leadingComments; + } + if (trailingComments && trailingComments.length > 0) { + this.trailingComments = trailingComments; + } - pairBuffer += state.dump; + bottomRight.push(this); + }, - // Both key and value are valid. - _result += pairBuffer; - } + finish: function () { + if (extra.range) { + this.range[1] = lastIndex; + } + if (extra.loc) { + this.loc.end = { + line: lastLineNumber, + column: lastIndex - lastLineStart + }; + if (extra.source) { + this.loc.source = extra.source; + } + } - state.tag = _tag; - state.dump = '{' + _result + '}'; -} + if (extra.attachComment) { + this.processComment(); + } + }, -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; + finishArrayExpression: function (elements) { + this.type = Syntax.ArrayExpression; + this.elements = elements; + this.finish(); + return this; + }, - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); - } + finishArrayPattern: function (elements) { + this.type = Syntax.ArrayPattern; + this.elements = elements; + this.finish(); + return this; + }, + + finishArrowFunctionExpression: function (params, defaults, body, expression) { + this.type = Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = expression; + this.finish(); + return this; + }, - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; + finishAssignmentExpression: function (operator, left, right) { + this.type = Syntax.AssignmentExpression; + this.operator = operator; + this.left = left; + this.right = right; + this.finish(); + return this; + }, - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } + finishAssignmentPattern: function (left, right) { + this.type = Syntax.AssignmentPattern; + this.left = left; + this.right = right; + this.finish(); + return this; + }, - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + finishBinaryExpression: function (operator, left, right) { + this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression; + this.operator = operator; + this.left = left; + this.right = right; + this.finish(); + return this; + }, - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } + finishBlockStatement: function (body) { + this.type = Syntax.BlockStatement; + this.body = body; + this.finish(); + return this; + }, - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); + finishBreakStatement: function (label) { + this.type = Syntax.BreakStatement; + this.label = label; + this.finish(); + return this; + }, - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } + finishCallExpression: function (callee, args) { + this.type = Syntax.CallExpression; + this.callee = callee; + this.arguments = args; + this.finish(); + return this; + }, - pairBuffer += state.dump; + finishCatchClause: function (param, body) { + this.type = Syntax.CatchClause; + this.param = param; + this.body = body; + this.finish(); + return this; + }, - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } + finishClassBody: function (body) { + this.type = Syntax.ClassBody; + this.body = body; + this.finish(); + return this; + }, + + finishClassDeclaration: function (id, superClass, body) { + this.type = Syntax.ClassDeclaration; + this.id = id; + this.superClass = superClass; + this.body = body; + this.finish(); + return this; + }, + + finishClassExpression: function (id, superClass, body) { + this.type = Syntax.ClassExpression; + this.id = id; + this.superClass = superClass; + this.body = body; + this.finish(); + return this; + }, + + finishConditionalExpression: function (test, consequent, alternate) { + this.type = Syntax.ConditionalExpression; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + this.finish(); + return this; + }, + + finishContinueStatement: function (label) { + this.type = Syntax.ContinueStatement; + this.label = label; + this.finish(); + return this; + }, + + finishDebuggerStatement: function () { + this.type = Syntax.DebuggerStatement; + this.finish(); + return this; + }, + + finishDoWhileStatement: function (body, test) { + this.type = Syntax.DoWhileStatement; + this.body = body; + this.test = test; + this.finish(); + return this; + }, + + finishEmptyStatement: function () { + this.type = Syntax.EmptyStatement; + this.finish(); + return this; + }, + + finishExpressionStatement: function (expression) { + this.type = Syntax.ExpressionStatement; + this.expression = expression; + this.finish(); + return this; + }, + + finishForStatement: function (init, test, update, body) { + this.type = Syntax.ForStatement; + this.init = init; + this.test = test; + this.update = update; + this.body = body; + this.finish(); + return this; + }, + + finishForOfStatement: function (left, right, body) { + this.type = Syntax.ForOfStatement; + this.left = left; + this.right = right; + this.body = body; + this.finish(); + return this; + }, + + finishForInStatement: function (left, right, body) { + this.type = Syntax.ForInStatement; + this.left = left; + this.right = right; + this.body = body; + this.each = false; + this.finish(); + return this; + }, + + finishFunctionDeclaration: function (id, params, defaults, body, generator) { + this.type = Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = generator; + this.expression = false; + this.finish(); + return this; + }, + + finishFunctionExpression: function (id, params, defaults, body, generator) { + this.type = Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = generator; + this.expression = false; + this.finish(); + return this; + }, + + finishIdentifier: function (name) { + this.type = Syntax.Identifier; + this.name = name; + this.finish(); + return this; + }, + + finishIfStatement: function (test, consequent, alternate) { + this.type = Syntax.IfStatement; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + this.finish(); + return this; + }, + + finishLabeledStatement: function (label, body) { + this.type = Syntax.LabeledStatement; + this.label = label; + this.body = body; + this.finish(); + return this; + }, + + finishLiteral: function (token) { + this.type = Syntax.Literal; + this.value = token.value; + this.raw = source.slice(token.start, token.end); + if (token.regex) { + this.regex = token.regex; + } + this.finish(); + return this; + }, - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } + finishMemberExpression: function (accessor, object, property) { + this.type = Syntax.MemberExpression; + this.computed = accessor === '['; + this.object = object; + this.property = property; + this.finish(); + return this; + }, - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } + finishMetaProperty: function (meta, property) { + this.type = Syntax.MetaProperty; + this.meta = meta; + this.property = property; + this.finish(); + return this; + }, - pairBuffer += state.dump; + finishNewExpression: function (callee, args) { + this.type = Syntax.NewExpression; + this.callee = callee; + this.arguments = args; + this.finish(); + return this; + }, - // Both key and value are valid. - _result += pairBuffer; - } + finishObjectExpression: function (properties) { + this.type = Syntax.ObjectExpression; + this.properties = properties; + this.finish(); + return this; + }, - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} + finishObjectPattern: function (properties) { + this.type = Syntax.ObjectPattern; + this.properties = properties; + this.finish(); + return this; + }, -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; + finishPostfixExpression: function (operator, argument) { + this.type = Syntax.UpdateExpression; + this.operator = operator; + this.argument = argument; + this.prefix = false; + this.finish(); + return this; + }, - typeList = explicit ? state.explicitTypes : state.implicitTypes; + finishProgram: function (body, sourceType) { + this.type = Syntax.Program; + this.body = body; + this.sourceType = sourceType; + this.finish(); + return this; + }, - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; + finishProperty: function (kind, key, computed, value, method, shorthand) { + this.type = Syntax.Property; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.method = method; + this.shorthand = shorthand; + this.finish(); + return this; + }, - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { + finishRestElement: function (argument) { + this.type = Syntax.RestElement; + this.argument = argument; + this.finish(); + return this; + }, - state.tag = explicit ? type.tag : '?'; + finishReturnStatement: function (argument) { + this.type = Syntax.ReturnStatement; + this.argument = argument; + this.finish(); + return this; + }, - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; + finishSequenceExpression: function (expressions) { + this.type = Syntax.SequenceExpression; + this.expressions = expressions; + this.finish(); + return this; + }, - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } + finishSpreadElement: function (argument) { + this.type = Syntax.SpreadElement; + this.argument = argument; + this.finish(); + return this; + }, - state.dump = _result; - } + finishSwitchCase: function (test, consequent) { + this.type = Syntax.SwitchCase; + this.test = test; + this.consequent = consequent; + this.finish(); + return this; + }, - return true; - } - } + finishSuper: function () { + this.type = Syntax.Super; + this.finish(); + return this; + }, - return false; -} + finishSwitchStatement: function (discriminant, cases) { + this.type = Syntax.SwitchStatement; + this.discriminant = discriminant; + this.cases = cases; + this.finish(); + return this; + }, -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; + finishTaggedTemplateExpression: function (tag, quasi) { + this.type = Syntax.TaggedTemplateExpression; + this.tag = tag; + this.quasi = quasi; + this.finish(); + return this; + }, - if (!detectType(state, object, false)) { - detectType(state, object, true); - } + finishTemplateElement: function (value, tail) { + this.type = Syntax.TemplateElement; + this.value = value; + this.tail = tail; + this.finish(); + return this; + }, - var type = _toString.call(state.dump); + finishTemplateLiteral: function (quasis, expressions) { + this.type = Syntax.TemplateLiteral; + this.quasis = quasis; + this.expressions = expressions; + this.finish(); + return this; + }, - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } + finishThisExpression: function () { + this.type = Syntax.ThisExpression; + this.finish(); + return this; + }, - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; + finishThrowStatement: function (argument) { + this.type = Syntax.ThrowStatement; + this.argument = argument; + this.finish(); + return this; + }, - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } + finishTryStatement: function (block, handler, finalizer) { + this.type = Syntax.TryStatement; + this.block = block; + this.guardedHandlers = []; + this.handlers = handler ? [handler] : []; + this.handler = handler; + this.finalizer = finalizer; + this.finish(); + return this; + }, - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } + finishUnaryExpression: function (operator, argument) { + this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression; + this.operator = operator; + this.argument = argument; + this.prefix = true; + this.finish(); + return this; + }, - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - if (block && (state.dump.length !== 0)) { - writeBlockSequence(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new YAMLException('unacceptable kind of an object to dump ' + type); - } + finishVariableDeclaration: function (declarations) { + this.type = Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = 'var'; + this.finish(); + return this; + }, - if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; - } - } + finishLexicalDeclaration: function (declarations, kind) { + this.type = Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = kind; + this.finish(); + return this; + }, - return true; -} + finishVariableDeclarator: function (id, init) { + this.type = Syntax.VariableDeclarator; + this.id = id; + this.init = init; + this.finish(); + return this; + }, -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; + finishWhileStatement: function (test, body) { + this.type = Syntax.WhileStatement; + this.test = test; + this.body = body; + this.finish(); + return this; + }, - inspectNode(object, objects, duplicatesIndexes); + finishWithStatement: function (object, body) { + this.type = Syntax.WithStatement; + this.object = object; + this.body = body; + this.finish(); + return this; + }, - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} + finishExportSpecifier: function (local, exported) { + this.type = Syntax.ExportSpecifier; + this.exported = exported || local; + this.local = local; + this.finish(); + return this; + }, -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; + finishImportDefaultSpecifier: function (local) { + this.type = Syntax.ImportDefaultSpecifier; + this.local = local; + this.finish(); + return this; + }, - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); + finishImportNamespaceSpecifier: function (local) { + this.type = Syntax.ImportNamespaceSpecifier; + this.local = local; + this.finish(); + return this; + }, - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); + finishExportNamedDeclaration: function (declaration, specifiers, src) { + this.type = Syntax.ExportNamedDeclaration; + this.declaration = declaration; + this.specifiers = specifiers; + this.source = src; + this.finish(); + return this; + }, - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + finishExportDefaultDeclaration: function (declaration) { + this.type = Syntax.ExportDefaultDeclaration; + this.declaration = declaration; + this.finish(); + return this; + }, + + finishExportAllDeclaration: function (src) { + this.type = Syntax.ExportAllDeclaration; + this.source = src; + this.finish(); + return this; + }, + + finishImportSpecifier: function (local, imported) { + this.type = Syntax.ImportSpecifier; + this.local = local || imported; + this.imported = imported; + this.finish(); + return this; + }, + + finishImportDeclaration: function (specifiers, src) { + this.type = Syntax.ImportDeclaration; + this.specifiers = specifiers; + this.source = src; + this.finish(); + return this; + }, + + finishYieldExpression: function (argument, delegate) { + this.type = Syntax.YieldExpression; + this.argument = argument; + this.delegate = delegate; + this.finish(); + return this; } - } - } - } -} + }; -function dump(input, options) { - options = options || {}; - var state = new State(options); + function recordError(error) { + var e, existing; - if (!state.noRefs) getDuplicateReferences(input, state); + for (e = 0; e < extra.errors.length; e++) { + existing = extra.errors[e]; + // Prevent duplicated error. + /* istanbul ignore next */ + if (existing.index === error.index && existing.message === error.message) { + return; + } + } - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + extra.errors.push(error); + } - return ''; -} + function constructError(msg, column) { + var error = new Error(msg); + try { + throw error; + } catch (base) { + /* istanbul ignore else */ + if (Object.create && Object.defineProperty) { + error = Object.create(base); + Object.defineProperty(error, 'column', { value: column }); + } + } finally { + return error; + } + } -function safeDump(input, options) { - return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} + function createError(line, pos, description) { + var msg, column, error; -module.exports.dump = dump; -module.exports.safeDump = safeDump; + msg = 'Line ' + line + ': ' + description; + column = pos - (scanning ? lineStart : lastLineStart) + 1; + error = constructError(msg, column); + error.lineNumber = line; + error.description = description; + error.index = pos; + return error; + } -},{"./common":25,"./exception":27,"./schema/default_full":32,"./schema/default_safe":33}],27:[function(require,module,exports){ -// YAML error class. http://stackoverflow.com/questions/8458984 -// -'use strict'; + // Throw an exception -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); + function throwError(messageFormat) { + var args, msg; - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } + args = Array.prototype.slice.call(arguments, 1); + msg = messageFormat.replace(/%(\d)/g, + function (whole, idx) { + assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + } + ); - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); -} + throw createError(lastLineNumber, lastIndex, msg); + } + function tolerateError(messageFormat) { + var args, msg, error; -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; + args = Array.prototype.slice.call(arguments, 1); + /* istanbul ignore next */ + msg = messageFormat.replace(/%(\d)/g, + function (whole, idx) { + assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + } + ); + error = createError(lineNumber, lastIndex, msg); + if (extra.errors) { + recordError(error); + } else { + throw error; + } + } -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; + // Throw an exception because of the token. - result += this.reason || '(unknown reason)'; + function unexpectedTokenError(token, message) { + var value, msg = message || Messages.UnexpectedToken; - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } + if (token) { + if (!message) { + msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS : + (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier : + (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber : + (token.type === Token.StringLiteral) ? Messages.UnexpectedString : + (token.type === Token.Template) ? Messages.UnexpectedTemplate : + Messages.UnexpectedToken; - return result; -}; + if (token.type === Token.Keyword) { + if (isFutureReservedWord(token.value)) { + msg = Messages.UnexpectedReserved; + } else if (strict && isStrictModeReservedWord(token.value)) { + msg = Messages.StrictReservedWord; + } + } + } + value = (token.type === Token.Template) ? token.value.raw : token.value; + } else { + value = 'ILLEGAL'; + } -module.exports = YAMLException; + msg = msg.replace('%0', value); -},{}],28:[function(require,module,exports){ -'use strict'; + return (token && typeof token.lineNumber === 'number') ? + createError(token.lineNumber, token.start, msg) : + createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg); + } -/*eslint-disable max-len,no-use-before-define*/ + function throwUnexpectedToken(token, message) { + throw unexpectedTokenError(token, message); + } -var common = require('./common'); -var YAMLException = require('./exception'); -var Mark = require('./mark'); -var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); -var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + function tolerateUnexpectedToken(token, message) { + var error = unexpectedTokenError(token, message); + if (extra.errors) { + recordError(error); + } else { + throw error; + } + } + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. -var _hasOwnProperty = Object.prototype.hasOwnProperty; + function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpectedToken(token); + } + } + /** + * @name expectCommaSeparator + * @description Quietly expect a comma when in tolerant mode, otherwise delegates + * to expect(value) + * @since 2.0 + */ + function expectCommaSeparator() { + var token; + + if (extra.errors) { + token = lookahead; + if (token.type === Token.Punctuator && token.value === ',') { + lex(); + } else if (token.type === Token.Punctuator && token.value === ';') { + lex(); + tolerateUnexpectedToken(token); + } else { + tolerateUnexpectedToken(token, Messages.UnexpectedToken); + } + } else { + expect(','); + } + } -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpectedToken(token); + } + } -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; + // Return true if the next token matches the specified punctuator. + function match(value) { + return lookahead.type === Token.Punctuator && lookahead.value === value; + } -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + // Return true if the next token matches the specified keyword + function matchKeyword(keyword) { + return lookahead.type === Token.Keyword && lookahead.value === keyword; + } -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} + // Return true if the next token matches the specified contextual keyword + // (where an identifier is sometimes a keyword depending on the context) -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} + function matchContextualKeyword(keyword) { + return lookahead.type === Token.Identifier && lookahead.value === keyword; + } -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} + // Return true if the next token is an assignment operator -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} + function matchAssign() { + var op; -function fromHexCode(c) { - var lc; + if (lookahead.type !== Token.Punctuator) { + return false; + } + op = lookahead.value; + return op === '=' || + op === '*=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + } + + function consumeSemicolon() { + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(startIndex) === 0x3B || match(';')) { + lex(); + return; + } - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } + if (hasLineTerminator) { + return; + } - /*eslint-disable no-bitwise*/ - lc = c | 0x20; + // FIXME(ikarienator): this is seemingly an issue in the previous location info convention. + lastIndex = startIndex; + lastLineNumber = startLineNumber; + lastLineStart = startLineStart; - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } + if (lookahead.type !== Token.EOF && !match('}')) { + throwUnexpectedToken(lookahead); + } + } - return -1; -} + // Cover grammar support. + // + // When an assignment expression position starts with an left parenthesis, the determination of the type + // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) + // or the first comma. This situation also defers the determination of all the expressions nested in the pair. + // + // There are three productions that can be parsed in a parentheses pair that needs to be determined + // after the outermost pair is closed. They are: + // + // 1. AssignmentExpression + // 2. BindingElements + // 3. AssignmentTargets + // + // In order to avoid exponential backtracking, we use two flags to denote if the production can be + // binding element or assignment target. + // + // The three productions have the relationship: + // + // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression + // + // with a single exception that CoverInitializedName when used directly in an Expression, generates + // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the + // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. + // + // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not + // effect the current flags. This means the production the parser parses is only used as an expression. Therefore + // the CoverInitializedName check is conducted. + // + // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates + // the flags outside of the parser. This means the production the parser parses is used as a part of a potential + // pattern. The CoverInitializedName check is deferred. + function isolateCoverGrammar(parser) { + var oldIsBindingElement = isBindingElement, + oldIsAssignmentTarget = isAssignmentTarget, + oldFirstCoverInitializedNameError = firstCoverInitializedNameError, + result; + isBindingElement = true; + isAssignmentTarget = true; + firstCoverInitializedNameError = null; + result = parser(); + if (firstCoverInitializedNameError !== null) { + throwUnexpectedToken(firstCoverInitializedNameError); + } + isBindingElement = oldIsBindingElement; + isAssignmentTarget = oldIsAssignmentTarget; + firstCoverInitializedNameError = oldFirstCoverInitializedNameError; + return result; + } + + function inheritCoverGrammar(parser) { + var oldIsBindingElement = isBindingElement, + oldIsAssignmentTarget = isAssignmentTarget, + oldFirstCoverInitializedNameError = firstCoverInitializedNameError, + result; + isBindingElement = true; + isAssignmentTarget = true; + firstCoverInitializedNameError = null; + result = parser(); + isBindingElement = isBindingElement && oldIsBindingElement; + isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget; + firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError; + return result; + } + + // ECMA-262 13.3.3 Destructuring Binding Patterns + + function parseArrayPattern(params, kind) { + var node = new Node(), elements = [], rest, restNode; + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else { + if (match('...')) { + restNode = new Node(); + lex(); + params.push(lookahead); + rest = parseVariableIdentifier(kind); + elements.push(restNode.finishRestElement(rest)); + break; + } else { + elements.push(parsePatternWithDefault(params, kind)); + } + if (!match(']')) { + expect(','); + } + } -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} + } -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } + expect(']'); - return -1; -} + return node.finishArrayPattern(elements); + } -function simpleEscapeSequence(c) { - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} + function parsePropertyPattern(params, kind) { + var node = new Node(), key, keyToken, computed = match('['), init; + if (lookahead.type === Token.Identifier) { + keyToken = lookahead; + key = parseVariableIdentifier(); + if (match('=')) { + params.push(keyToken); + lex(); + init = parseAssignmentExpression(); -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00); -} + return node.finishProperty( + 'init', key, false, + new WrappingNode(keyToken).finishAssignmentPattern(key, init), false, false); + } else if (!match(':')) { + params.push(keyToken); + return node.finishProperty('init', key, false, key, false, true); + } + } else { + key = parseObjectPropertyKey(); + } + expect(':'); + init = parsePatternWithDefault(params, kind); + return node.finishProperty('init', key, computed, init, false, false); + } -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} + function parseObjectPattern(params, kind) { + var node = new Node(), properties = []; + expect('{'); -function State(input, options) { - this.input = input; + while (!match('}')) { + properties.push(parsePropertyPattern(params, kind)); + if (!match('}')) { + expect(','); + } + } - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; + lex(); - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; + return node.finishObjectPattern(properties); + } - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; + function parsePattern(params, kind) { + if (match('[')) { + return parseArrayPattern(params, kind); + } else if (match('{')) { + return parseObjectPattern(params, kind); + } else if (matchKeyword('let')) { + if (kind === 'const' || kind === 'let') { + tolerateUnexpectedToken(lookahead, Messages.UnexpectedToken); + } + } - this.documents = []; + params.push(lookahead); + return parseVariableIdentifier(kind); + } - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ + function parsePatternWithDefault(params, kind) { + var startToken = lookahead, pattern, previousAllowYield, right; + pattern = parsePattern(params, kind); + if (match('=')) { + lex(); + previousAllowYield = state.allowYield; + state.allowYield = true; + right = isolateCoverGrammar(parseAssignmentExpression); + state.allowYield = previousAllowYield; + pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right); + } + return pattern; + } -} + // ECMA-262 12.2.5 Array Initializer + function parseArrayInitializer() { + var elements = [], node = new Node(), restSpread; -function generateError(state, message) { - return new YAMLException( - message, - new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); -} + expect('['); -function throwError(state, message) { - throw generateError(state, message); -} + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else if (match('...')) { + restSpread = new Node(); + lex(); + restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression)); -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} + if (!match(']')) { + isAssignmentTarget = isBindingElement = false; + expect(','); + } + elements.push(restSpread); + } else { + elements.push(inheritCoverGrammar(parseAssignmentExpression)); + if (!match(']')) { + expect(','); + } + } + } -var directiveHandlers = { + lex(); - YAML: function handleYamlDirective(state, name, args) { + return node.finishArrayExpression(elements); + } - var match, major, minor; + // ECMA-262 12.2.6 Object Initializer - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } + function parsePropertyFunction(node, paramInfo, isGenerator) { + var previousStrict, body; - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } + isAssignmentTarget = isBindingElement = false; - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + previousStrict = strict; + body = isolateCoverGrammar(parseFunctionSourceElements); + + if (strict && paramInfo.firstRestricted) { + tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message); + } + if (strict && paramInfo.stricted) { + tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message); + } - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); + strict = previousStrict; + return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body, isGenerator); } - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); + function parsePropertyMethodFunction() { + var params, method, node = new Node(), + previousAllowYield = state.allowYield; - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } + state.allowYield = false; + params = parseParams(); + state.allowYield = previousAllowYield; - state.version = args[0]; - state.checkLineBreaks = (minor < 2); + state.allowYield = false; + method = parsePropertyFunction(node, params, false); + state.allowYield = previousAllowYield; - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); + return method; } - }, - - TAG: function handleTagDirective(state, name, args) { - var handle, prefix; + function parseObjectPropertyKey() { + var token, node = new Node(), expr; - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } + token = lex(); - handle = args[0]; - prefix = args[1]; + // Note: This function is called only from parseObjectProperty(), where + // EOF and Punctuator tokens are already filtered out. - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + switch (token.type) { + case Token.StringLiteral: + case Token.NumericLiteral: + if (strict && token.octal) { + tolerateUnexpectedToken(token, Messages.StrictOctalLiteral); + } + return node.finishLiteral(token); + case Token.Identifier: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.Keyword: + return node.finishIdentifier(token.value); + case Token.Punctuator: + if (token.value === '[') { + expr = isolateCoverGrammar(parseAssignmentExpression); + expect(']'); + return expr; + } + break; + } + throwUnexpectedToken(token); } - if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + function lookaheadPropertyName() { + switch (lookahead.type) { + case Token.Identifier: + case Token.StringLiteral: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.NumericLiteral: + case Token.Keyword: + return true; + case Token.Punctuator: + return lookahead.value === '['; + } + return false; } - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } + // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals, + // it might be called at a position where there is in fact a short hand identifier pattern or a data property. + // This can only be determined after we consumed up to the left parentheses. + // + // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller + // is responsible to visit other options. + function tryParseMethodDefinition(token, key, computed, node) { + var value, options, methodNode, params, + previousAllowYield = state.allowYield; + + if (token.type === Token.Identifier) { + // check for `get` and `set`; + + if (token.value === 'get' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); + expect('('); + expect(')'); + + state.allowYield = false; + value = parsePropertyFunction(methodNode, { + params: [], + defaults: [], + stricted: null, + firstRestricted: null, + message: null + }, false); + state.allowYield = previousAllowYield; + + return node.finishProperty('get', key, computed, value, false, false); + } else if (token.value === 'set' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); + expect('('); + + options = { + params: [], + defaultCount: 0, + defaults: [], + firstRestricted: null, + paramSet: {} + }; + if (match(')')) { + tolerateUnexpectedToken(lookahead); + } else { + state.allowYield = false; + parseParam(options); + state.allowYield = previousAllowYield; + if (options.defaultCount === 0) { + options.defaults = []; + } + } + expect(')'); - state.tagMap[handle] = prefix; - } -}; + state.allowYield = false; + value = parsePropertyFunction(methodNode, options, false); + state.allowYield = previousAllowYield; + return node.finishProperty('set', key, computed, value, false, false); + } + } else if (token.type === Token.Punctuator && token.value === '*' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; + state.allowYield = true; + params = parseParams(); + state.allowYield = previousAllowYield; - if (start < end) { - _result = state.input.slice(start, end); + state.allowYield = false; + value = parsePropertyFunction(methodNode, params, true); + state.allowYield = previousAllowYield; - if (checkJson) { - for (_position = 0, _length = _result.length; - _position < _length; - _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); + return node.finishProperty('init', key, computed, value, true, false); } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); + + if (key && match('(')) { + value = parsePropertyMethodFunction(); + return node.finishProperty('init', key, computed, value, true, false); + } + + // Not a MethodDefinition. + return null; } - state.result += _result; - } -} + function parseObjectProperty(hasProto) { + var token = lookahead, node = new Node(), computed, key, maybeMethod, proto, value; -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; + computed = match('['); + if (match('*')) { + lex(); + } else { + key = parseObjectPropertyKey(); + } + maybeMethod = tryParseMethodDefinition(token, key, computed, node); + if (maybeMethod) { + return maybeMethod; + } - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } + if (!key) { + throwUnexpectedToken(lookahead); + } - sourceKeys = Object.keys(source); + // Check for duplicated __proto__ + if (!computed) { + proto = (key.type === Syntax.Identifier && key.name === '__proto__') || + (key.type === Syntax.Literal && key.value === '__proto__'); + if (hasProto.value && proto) { + tolerateError(Messages.DuplicateProtoProperty); + } + hasProto.value |= proto; + } - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; + if (match(':')) { + lex(); + value = inheritCoverGrammar(parseAssignmentExpression); + return node.finishProperty('init', key, computed, value, false, false); + } - if (!_hasOwnProperty.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; + if (token.type === Token.Identifier) { + if (match('=')) { + firstCoverInitializedNameError = lookahead; + lex(); + value = isolateCoverGrammar(parseAssignmentExpression); + return node.finishProperty('init', key, computed, + new WrappingNode(token).finishAssignmentPattern(key, value), false, true); + } + return node.finishProperty('init', key, computed, key, false, true); + } + + throwUnexpectedToken(lookahead); } - } -} -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) { - var index, quantity; + function parseObjectInitializer() { + var properties = [], hasProto = {value: false}, node = new Node(); - keyNode = String(keyNode); + expect('{'); - if (_result === null) { - _result = {}; - } + while (!match('}')) { + properties.push(parseObjectProperty(hasProto)); - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); + if (!match('}')) { + expectCommaSeparator(); + } + } + + expect('}'); + + return node.finishObjectExpression(properties); } - } else { - if (!state.json && - !_hasOwnProperty.call(overridableKeys, keyNode) && - _hasOwnProperty.call(_result, keyNode)) { - throwError(state, 'duplicated mapping key'); + + function reinterpretExpressionAsPattern(expr) { + var i; + switch (expr.type) { + case Syntax.Identifier: + case Syntax.MemberExpression: + case Syntax.RestElement: + case Syntax.AssignmentPattern: + break; + case Syntax.SpreadElement: + expr.type = Syntax.RestElement; + reinterpretExpressionAsPattern(expr.argument); + break; + case Syntax.ArrayExpression: + expr.type = Syntax.ArrayPattern; + for (i = 0; i < expr.elements.length; i++) { + if (expr.elements[i] !== null) { + reinterpretExpressionAsPattern(expr.elements[i]); + } + } + break; + case Syntax.ObjectExpression: + expr.type = Syntax.ObjectPattern; + for (i = 0; i < expr.properties.length; i++) { + reinterpretExpressionAsPattern(expr.properties[i].value); + } + break; + case Syntax.AssignmentExpression: + expr.type = Syntax.AssignmentPattern; + reinterpretExpressionAsPattern(expr.left); + break; + default: + // Allow other node type for tolerant parsing. + break; + } } - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; - } - return _result; -} + // ECMA-262 12.2.9 Template Literals -function readLineBreak(state) { - var ch; + function parseTemplateElement(option) { + var node, token; - ch = state.input.charCodeAt(state.position); + if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) { + throwUnexpectedToken(); + } - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; + node = new Node(); + token = lex(); + + return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail); } - } else { - throwError(state, 'a line break is expected'); - } - state.line += 1; - state.lineStart = state.position; -} + function parseTemplateLiteral() { + var quasi, quasis, expressions, node = new Node(); -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); + quasi = parseTemplateElement({ head: true }); + quasis = [quasi]; + expressions = []; - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } + while (!quasi.tail) { + expressions.push(parseExpression()); + quasi = parseTemplateElement({ head: false }); + quasis.push(quasi); + } - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + return node.finishTemplateLiteral(quasis, expressions); } - if (is_EOL(ch)) { - readLineBreak(state); + // ECMA-262 12.2.10 The Grouping Operator - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; + function parseGroupExpression() { + var expr, expressions, startToken, i, params = []; - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } + expect('('); - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } + if (match(')')) { + lex(); + if (!match('=>')) { + expect('=>'); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [], + rawParams: [] + }; + } + + startToken = lookahead; + if (match('...')) { + expr = parseRestElement(params); + expect(')'); + if (!match('=>')) { + expect('=>'); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [expr] + }; + } - return lineBreaks; -} + isBindingElement = true; + expr = inheritCoverGrammar(parseAssignmentExpression); -function testDocumentSeparator(state) { - var _position = state.position, - ch; + if (match(',')) { + isAssignmentTarget = false; + expressions = [expr]; - ch = state.input.charCodeAt(_position); + while (startIndex < length) { + if (!match(',')) { + break; + } + lex(); - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { + if (match('...')) { + if (!isBindingElement) { + throwUnexpectedToken(lookahead); + } + expressions.push(parseRestElement(params)); + expect(')'); + if (!match('=>')) { + expect('=>'); + } + isBindingElement = false; + for (i = 0; i < expressions.length; i++) { + reinterpretExpressionAsPattern(expressions[i]); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: expressions + }; + } - _position += 3; + expressions.push(inheritCoverGrammar(parseAssignmentExpression)); + } - ch = state.input.charCodeAt(_position); + expr = new WrappingNode(startToken).finishSequenceExpression(expressions); + } - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; + + expect(')'); + + if (match('=>')) { + if (expr.type === Syntax.Identifier && expr.name === 'yield') { + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [expr] + }; + } + + if (!isBindingElement) { + throwUnexpectedToken(lookahead); + } + + if (expr.type === Syntax.SequenceExpression) { + for (i = 0; i < expr.expressions.length; i++) { + reinterpretExpressionAsPattern(expr.expressions[i]); + } + } else { + reinterpretExpressionAsPattern(expr); + } + + expr = { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr] + }; + } + isBindingElement = false; + return expr; } - } - return false; -} -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} + // ECMA-262 12.2 Primary Expressions + function parsePrimaryExpression() { + var type, token, expr, node; -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; + if (match('(')) { + isBindingElement = false; + return inheritCoverGrammar(parseGroupExpression); + } - ch = state.input.charCodeAt(state.position); + if (match('[')) { + return inheritCoverGrammar(parseArrayInitializer); + } - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } + if (match('{')) { + return inheritCoverGrammar(parseObjectInitializer); + } - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); + type = lookahead.type; + node = new Node(); - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; + if (type === Token.Identifier) { + if (state.sourceType === 'module' && lookahead.value === 'await') { + tolerateUnexpectedToken(lookahead); + } + expr = node.finishIdentifier(lex().value); + } else if (type === Token.StringLiteral || type === Token.NumericLiteral) { + isAssignmentTarget = isBindingElement = false; + if (strict && lookahead.octal) { + tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral); + } + expr = node.finishLiteral(lex()); + } else if (type === Token.Keyword) { + if (!strict && state.allowYield && matchKeyword('yield')) { + return parseNonComputedProperty(); + } + if (!strict && matchKeyword('let')) { + return node.finishIdentifier(lex().value); + } + isAssignmentTarget = isBindingElement = false; + if (matchKeyword('function')) { + return parseFunctionExpression(); + } + if (matchKeyword('this')) { + lex(); + return node.finishThisExpression(); + } + if (matchKeyword('class')) { + return parseClassExpression(); + } + throwUnexpectedToken(lex()); + } else if (type === Token.BooleanLiteral) { + isAssignmentTarget = isBindingElement = false; + token = lex(); + token.value = (token.value === 'true'); + expr = node.finishLiteral(token); + } else if (type === Token.NullLiteral) { + isAssignmentTarget = isBindingElement = false; + token = lex(); + token.value = null; + expr = node.finishLiteral(token); + } else if (match('/') || match('/=')) { + isAssignmentTarget = isBindingElement = false; + index = startIndex; + + if (typeof extra.tokens !== 'undefined') { + token = collectRegex(); + } else { + token = scanRegExp(); + } + lex(); + expr = node.finishLiteral(token); + } else if (type === Token.Template) { + expr = parseTemplateLiteral(); + } else { + throwUnexpectedToken(lex()); + } + + return expr; } - } - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; + // ECMA-262 12.3 Left-Hand-Side Expressions - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); + function parseArguments() { + var args = [], expr; - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } + expect('('); - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); + if (!match(')')) { + while (startIndex < length) { + if (match('...')) { + expr = new Node(); + lex(); + expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression)); + } else { + expr = isolateCoverGrammar(parseAssignmentExpression); + } + args.push(expr); + if (match(')')) { + break; + } + expectCommaSeparator(); + } + } - if (is_WS_OR_EOL(preceding)) { - break; - } + expect(')'); - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; + return args; + } - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); + function parseNonComputedProperty() { + var token, node = new Node(); - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } + token = lex(); - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } + if (!isIdentifierName(token)) { + throwUnexpectedToken(token); + } - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; + return node.finishIdentifier(token.value); } - ch = state.input.charCodeAt(++state.position); - } + function parseNonComputedMember() { + expect('.'); - captureSegment(state, captureStart, captureEnd, false); + return parseNonComputedProperty(); + } - if (state.result) { - return true; - } + function parseComputedMember() { + var expr; - state.kind = _kind; - state.result = _result; - return false; -} + expect('['); -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; + expr = isolateCoverGrammar(parseExpression); - ch = state.input.charCodeAt(state.position); + expect(']'); - if (ch !== 0x27/* ' */) { - return false; - } + return expr; + } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + // ECMA-262 12.3.3 The new Operator - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + function parseNewExpression() { + var callee, args, node = new Node(); - if (ch === 0x27/* ' */) { - captureStart = captureEnd = state.position; - state.position++; - } else { - return true; - } + expectKeyword('new'); - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; + if (match('.')) { + lex(); + if (lookahead.type === Token.Identifier && lookahead.value === 'target') { + if (state.inFunctionBody) { + lex(); + return node.finishMetaProperty('new', 'target'); + } + } + throwUnexpectedToken(lookahead); + } - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); + callee = isolateCoverGrammar(parseLeftHandSideExpression); + args = match('(') ? parseArguments() : []; - } else { - state.position++; - captureEnd = state.position; + isAssignmentTarget = isBindingElement = false; + + return node.finishNewExpression(callee, args); } - } - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} + // ECMA-262 12.3.4 Function Calls -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; + function parseLeftHandSideExpressionAllowCall() { + var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn; - ch = state.input.charCodeAt(state.position); + startToken = lookahead; + state.allowIn = true; - if (ch !== 0x22/* " */) { - return false; - } + if (matchKeyword('super') && state.inFunctionBody) { + expr = new Node(); + lex(); + expr = expr.finishSuper(); + if (!match('(') && !match('.') && !match('[')) { + throwUnexpectedToken(lookahead); + } + } else { + expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); + } + + for (;;) { + if (match('.')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseNonComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); + } else if (match('(')) { + isBindingElement = false; + isAssignmentTarget = false; + args = parseArguments(); + expr = new WrappingNode(startToken).finishCallExpression(expr, args); + } else if (match('[')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); + } else if (lookahead.type === Token.Template && lookahead.head) { + quasi = parseTemplateLiteral(); + expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); + } else { + break; + } + } + state.allowIn = previousAllowIn; - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + return expr; + } - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; + // ECMA-262 12.3 Left-Hand-Side Expressions - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + function parseLeftHandSideExpression() { + var quasi, expr, property, startToken; + assert(state.allowIn, 'callee of new expression always allow in keyword.'); - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); + startToken = lookahead; - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; + if (matchKeyword('super') && state.inFunctionBody) { + expr = new Node(); + lex(); + expr = expr.finishSuper(); + if (!match('[') && !match('.')) { + throwUnexpectedToken(lookahead); + } + } else { + expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); + } + + for (;;) { + if (match('[')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); + } else if (match('.')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseNonComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); + } else if (lookahead.type === Token.Template && lookahead.head) { + quasi = parseTemplateLiteral(); + expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); + } else { + break; + } + } + return expr; + } - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; + // ECMA-262 12.4 Postfix Expressions - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); + function parsePostfixExpression() { + var expr, token, startToken = lookahead; - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; + expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall); - } else { - throwError(state, 'expected hexadecimal character'); - } - } + if (!hasLineTerminator && lookahead.type === Token.Punctuator) { + if (match('++') || match('--')) { + // ECMA-262 11.3.1, 11.3.2 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateError(Messages.StrictLHSPostfix); + } - state.result += charFromCodepoint(hexResult); + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } - state.position++; + isAssignmentTarget = isBindingElement = false; - } else { - throwError(state, 'unknown escape sequence'); - } + token = lex(); + expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr); + } + } - captureStart = captureEnd = state.position; + return expr; + } - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; + // ECMA-262 12.5 Unary Operators - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); + function parseUnaryExpression() { + var token, expr, startToken; - } else { - state.position++; - captureEnd = state.position; + if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { + expr = parsePostfixExpression(); + } else if (match('++') || match('--')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + // ECMA-262 11.4.4, 11.4.5 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateError(Messages.StrictLHSPrefix); + } + + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + isAssignmentTarget = isBindingElement = false; + } else if (match('+') || match('-') || match('~') || match('!')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + isAssignmentTarget = isBindingElement = false; + } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { + tolerateError(Messages.StrictDelete); + } + isAssignmentTarget = isBindingElement = false; + } else { + expr = parsePostfixExpression(); + } + + return expr; } - } - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} + function binaryPrecedence(token, allowIn) { + var prec = 0; -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; + if (token.type !== Token.Punctuator && token.type !== Token.Keyword) { + return 0; + } - ch = state.input.charCodeAt(state.position); + switch (token.value) { + case '||': + prec = 1; + break; - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } + case '&&': + prec = 2; + break; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } + case '|': + prec = 3; + break; - ch = state.input.charCodeAt(++state.position); + case '^': + prec = 4; + break; - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); + case '&': + prec = 5; + break; - ch = state.input.charCodeAt(state.position); + case '==': + case '!=': + case '===': + case '!==': + prec = 6; + break; - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } + case '<': + case '>': + case '<=': + case '>=': + case 'instanceof': + prec = 7; + break; - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; + case 'in': + prec = allowIn ? 7 : 0; + break; - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); + case '<<': + case '>>': + case '>>>': + prec = 8; + break; - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } + case '+': + case '-': + prec = 9; + break; - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); + case '*': + case '/': + case '%': + prec = 11; + break; - ch = state.input.charCodeAt(state.position); + default: + break; + } - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; + return prec; } - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } + // ECMA-262 12.6 Multiplicative Operators + // ECMA-262 12.7 Additive Operators + // ECMA-262 12.8 Bitwise Shift Operators + // ECMA-262 12.9 Relational Operators + // ECMA-262 12.10 Equality Operators + // ECMA-262 12.11 Binary Bitwise Operators + // ECMA-262 12.12 Binary Logical Operators - skipSeparationSpace(state, true, nodeIndent); + function parseBinaryExpression() { + var marker, markers, expr, token, prec, stack, right, operator, left, i; - ch = state.input.charCodeAt(state.position); + marker = lookahead; + left = inheritCoverGrammar(parseUnaryExpression); - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } + token = lookahead; + prec = binaryPrecedence(token, state.allowIn); + if (prec === 0) { + return left; + } + isAssignmentTarget = isBindingElement = false; + token.prec = prec; + lex(); - throwError(state, 'unexpected end of the stream within a flow collection'); -} + markers = [marker, lookahead]; + right = isolateCoverGrammar(parseUnaryExpression); -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; + stack = [left, token, right]; - ch = state.input.charCodeAt(state.position); + while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) { - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { + right = stack.pop(); + operator = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right); + stack.push(expr); + } - state.kind = 'scalar'; - state.result = ''; + // Shift. + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr = isolateCoverGrammar(parseUnaryExpression); + stack.push(expr); + } - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } + // Final reduce to clean-up the stack. + i = stack.length - 1; + expr = stack[i]; + markers.pop(); + while (i > 1) { + expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); + i -= 2; + } - } else { - break; + return expr; } - } - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } + // ECMA-262 12.13 Conditional Operator - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; + function parseConditionalExpression() { + var expr, previousAllowIn, consequent, alternate, startToken; - ch = state.input.charCodeAt(state.position); + startToken = lookahead; - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } + expr = inheritCoverGrammar(parseBinaryExpression); + if (match('?')) { + lex(); + previousAllowIn = state.allowIn; + state.allowIn = true; + consequent = isolateCoverGrammar(parseAssignmentExpression); + state.allowIn = previousAllowIn; + expect(':'); + alternate = isolateCoverGrammar(parseAssignmentExpression); - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } + expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate); + isAssignmentTarget = isBindingElement = false; + } - if (is_EOL(ch)) { - emptyLines++; - continue; + return expr; } - // End of the scalar. - if (state.lineIndent < textIndent) { + // ECMA-262 14.2 Arrow Function Definitions - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (detectedIndent) { // i.e. only if the scalar is not empty. - state.result += '\n'; + function parseConciseBody() { + if (match('{')) { + return parseFunctionSourceElements(); } - } + return isolateCoverGrammar(parseAssignmentExpression); + } - // Break this `while` cycle and go to the funciton's epilogue. - break; + function checkPatternParam(options, param) { + var i; + switch (param.type) { + case Syntax.Identifier: + validateParam(options, param, param.name); + break; + case Syntax.RestElement: + checkPatternParam(options, param.argument); + break; + case Syntax.AssignmentPattern: + checkPatternParam(options, param.left); + break; + case Syntax.ArrayPattern: + for (i = 0; i < param.elements.length; i++) { + if (param.elements[i] !== null) { + checkPatternParam(options, param.elements[i]); + } + } + break; + case Syntax.YieldExpression: + break; + default: + assert(param.type === Syntax.ObjectPattern, 'Invalid type'); + for (i = 0; i < param.properties.length; i++) { + checkPatternParam(options, param.properties[i].value); + } + break; + } } + function reinterpretAsCoverFormalsList(expr) { + var i, len, param, params, defaults, defaultCount, options, token; - // Folded style: use fancy rules to handle line breaks. - if (folding) { + defaults = []; + defaultCount = 0; + params = [expr]; - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - state.result += common.repeat('\n', emptyLines + 1); + switch (expr.type) { + case Syntax.Identifier: + break; + case PlaceHolders.ArrowParameterPlaceHolder: + params = expr.params; + break; + default: + return null; + } - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); + options = { + paramSet: {} + }; - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (detectedIndent) { // i.e. only if we have already read some scalar content. - state.result += ' '; + for (i = 0, len = params.length; i < len; i += 1) { + param = params[i]; + switch (param.type) { + case Syntax.AssignmentPattern: + params[i] = param.left; + if (param.right.type === Syntax.YieldExpression) { + if (param.right.argument) { + throwUnexpectedToken(lookahead); + } + param.right.type = Syntax.Identifier; + param.right.name = 'yield'; + delete param.right.argument; + delete param.right.delegate; + } + defaults.push(param.right); + ++defaultCount; + checkPatternParam(options, param.left); + break; + default: + checkPatternParam(options, param); + params[i] = param; + defaults.push(null); + break; + } } - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } + if (strict || !state.allowYield) { + for (i = 0, len = params.length; i < len; i += 1) { + param = params[i]; + if (param.type === Syntax.YieldExpression) { + throwUnexpectedToken(lookahead); + } + } + } - // Literal style: just add exact number of line breaks between content lines. - } else if (detectedIndent) { - // If current line isn't the first one - count line break from the last content line. - state.result += common.repeat('\n', emptyLines + 1); - } else { - // In case of the first content line - count only empty lines. - state.result += common.repeat('\n', emptyLines); - } + if (options.message === Messages.StrictParamDupe) { + token = strict ? options.stricted : options.firstRestricted; + throwUnexpectedToken(token, options.message); + } - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; + if (defaultCount === 0) { + defaults = []; + } - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); + return { + params: params, + defaults: defaults, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; } - captureSegment(state, captureStart, state.position, false); - } + function parseArrowFunctionExpression(options, node) { + var previousStrict, previousAllowYield, body; - return true; -} + if (hasLineTerminator) { + tolerateUnexpectedToken(lookahead); + } + expect('=>'); -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; + previousStrict = strict; + previousAllowYield = state.allowYield; + state.allowYield = true; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } + body = parseConciseBody(); - ch = state.input.charCodeAt(state.position); + if (strict && options.firstRestricted) { + throwUnexpectedToken(options.firstRestricted, options.message); + } + if (strict && options.stricted) { + tolerateUnexpectedToken(options.stricted, options.message); + } - while (ch !== 0) { + strict = previousStrict; + state.allowYield = previousAllowYield; - if (ch !== 0x2D/* - */) { - break; + return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement); } - following = state.input.charCodeAt(state.position + 1); + // ECMA-262 14.4 Yield expression - if (!is_WS_OR_EOL(following)) { - break; - } + function parseYieldExpression() { + var argument, expr, delegate, previousAllowYield; - detected = true; - state.position++; + argument = null; + expr = new Node(); + delegate = false; - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } + expectKeyword('yield'); + + if (!hasLineTerminator) { + previousAllowYield = state.allowYield; + state.allowYield = false; + delegate = match('*'); + if (delegate) { + lex(); + argument = parseAssignmentExpression(); + } else { + if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) { + argument = parseAssignmentExpression(); + } + } + state.allowYield = previousAllowYield; + } + + return expr.finishYieldExpression(argument, delegate); } - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); + // ECMA-262 12.14 Assignment Operators - ch = state.input.charCodeAt(state.position); + function parseAssignmentExpression() { + var token, expr, right, list, startToken; - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } + startToken = lookahead; + token = lookahead; - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} + if (!state.allowYield && matchKeyword('yield')) { + return parseYieldExpression(); + } -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; + expr = parseConditionalExpression(); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } + if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) { + isAssignmentTarget = isBindingElement = false; + list = reinterpretAsCoverFormalsList(expr); - ch = state.input.charCodeAt(state.position); + if (list) { + firstCoverInitializedNameError = null; + return parseArrowFunctionExpression(list, new WrappingNode(startToken)); + } - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. + return expr; + } - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + if (matchAssign()) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; + // ECMA-262 12.1.1 + if (strict && expr.type === Syntax.Identifier) { + if (isRestrictedWord(expr.name)) { + tolerateUnexpectedToken(token, Messages.StrictLHSAssignment); + } + if (isStrictModeReservedWord(expr.name)) { + tolerateUnexpectedToken(token, Messages.StrictReservedWord); + } + } + + if (!match('=')) { + isAssignmentTarget = isBindingElement = false; + } else { + reinterpretExpressionAsPattern(expr); + } + + token = lex(); + right = isolateCoverGrammar(parseAssignmentExpression); + expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right); + firstCoverInitializedNameError = null; } - detected = true; - atExplicitKey = true; - allowCompact = true; + return expr; + } - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; + // ECMA-262 12.15 Comma Operator - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed'); - } + function parseExpression() { + var expr, startToken = lookahead, expressions; - state.position += 1; - ch = following; + expr = isolateCoverGrammar(parseAssignmentExpression); - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + if (match(',')) { + expressions = [expr]; - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); + while (startIndex < length) { + if (!match(',')) { + break; + } + lex(); + expressions.push(isolateCoverGrammar(parseAssignmentExpression)); + } - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); + expr = new WrappingNode(startToken).finishSequenceExpression(expressions); } - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); + return expr; + } - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } + // ECMA-262 13.2 Block - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } + function parseStatementListItem() { + if (lookahead.type === Token.Keyword) { + switch (lookahead.value) { + case 'export': + if (state.sourceType !== 'module') { + tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration); + } + return parseExportDeclaration(); + case 'import': + if (state.sourceType !== 'module') { + tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration); + } + return parseImportDeclaration(); + case 'const': + return parseLexicalDeclaration({inFor: false}); + case 'function': + return parseFunctionDeclaration(new Node()); + case 'class': + return parseClassDeclaration(); + } + } - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; + if (matchKeyword('let') && isLexicalDeclaration()) { + return parseLexicalDeclaration({inFor: false}); + } - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + return parseStatement(); + } - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. + function parseStatementList() { + var list = []; + while (startIndex < length) { + if (match('}')) { + break; + } + list.push(parseStatementListItem()); } - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + return list; + } - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } + function parseBlock() { + var block, node = new Node(); - } else { - break; // Reading is done. Go to the epilogue. - } + expect('{'); - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } + block = parseStatementList(); - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - keyTag = keyNode = valueNode = null; - } + expect('}'); - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); + return node.finishBlockStatement(block); } - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } + // ECMA-262 13.3.2 Variable Statement - // - // Epilogue. - // + function parseVariableIdentifier(kind) { + var token, node = new Node(); - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - } + token = lex(); - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } + if (token.type === Token.Keyword && token.value === 'yield') { + if (strict) { + tolerateUnexpectedToken(token, Messages.StrictReservedWord); + } if (!state.allowYield) { + throwUnexpectedToken(token); + } + } else if (token.type !== Token.Identifier) { + if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictReservedWord); + } else { + if (strict || token.value !== 'let' || kind !== 'var') { + throwUnexpectedToken(token); + } + } + } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') { + tolerateUnexpectedToken(token); + } - return detected; -} + return node.finishIdentifier(token.value); + } -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; + function parseVariableDeclaration(options) { + var init = null, id, node = new Node(), params = []; - ch = state.input.charCodeAt(state.position); + id = parsePattern(params, 'var'); - if (ch !== 0x21/* ! */) return false; + // ECMA-262 12.2.1 + if (strict && isRestrictedWord(id.name)) { + tolerateError(Messages.StrictVarName); + } - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } + if (match('=')) { + lex(); + init = isolateCoverGrammar(parseAssignmentExpression); + } else if (id.type !== Syntax.Identifier && !options.inFor) { + expect('='); + } - ch = state.input.charCodeAt(++state.position); + return node.finishVariableDeclarator(id, init); + } - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); + function parseVariableDeclarationList(options) { + var opt, list; - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); + opt = { inFor: options.inFor }; + list = [parseVariableDeclaration(opt)]; - } else { - tagHandle = '!'; - } + while (match(',')) { + lex(); + list.push(parseVariableDeclaration(opt)); + } - _position = state.position; + return list; + } - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); + function parseVariableStatement(node) { + var declarations; - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); + expectKeyword('var'); + + declarations = parseVariableDeclarationList({ inFor: false }); + + consumeSemicolon(); + + return node.finishVariableDeclaration(declarations); } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); + // ECMA-262 13.3.1 Let and Const Declarations - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } + function parseLexicalBinding(kind, options) { + var init = null, id, node = new Node(), params = []; - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); + id = parsePattern(params, kind); + + // ECMA-262 12.2.1 + if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) { + tolerateError(Messages.StrictVarName); } - } - ch = state.input.charCodeAt(++state.position); + if (kind === 'const') { + if (!matchKeyword('in') && !matchContextualKeyword('of')) { + expect('='); + init = isolateCoverGrammar(parseAssignmentExpression); + } + } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) { + expect('='); + init = isolateCoverGrammar(parseAssignmentExpression); + } + + return node.finishVariableDeclarator(id, init); } - tagName = state.input.slice(_position, state.position); + function parseBindingList(kind, options) { + var list = [parseLexicalBinding(kind, options)]; - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); + while (match(',')) { + lex(); + list.push(parseLexicalBinding(kind, options)); + } + + return list; } - } - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - if (isVerbatim) { - state.tag = tagName; + function tokenizerState() { + return { + index: index, + lineNumber: lineNumber, + lineStart: lineStart, + hasLineTerminator: hasLineTerminator, + lastIndex: lastIndex, + lastLineNumber: lastLineNumber, + lastLineStart: lastLineStart, + startIndex: startIndex, + startLineNumber: startLineNumber, + startLineStart: startLineStart, + lookahead: lookahead, + tokenCount: extra.tokens ? extra.tokens.length : 0 + }; + } - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; + function resetTokenizerState(ts) { + index = ts.index; + lineNumber = ts.lineNumber; + lineStart = ts.lineStart; + hasLineTerminator = ts.hasLineTerminator; + lastIndex = ts.lastIndex; + lastLineNumber = ts.lastLineNumber; + lastLineStart = ts.lastLineStart; + startIndex = ts.startIndex; + startLineNumber = ts.startLineNumber; + startLineStart = ts.startLineStart; + lookahead = ts.lookahead; + if (extra.tokens) { + extra.tokens.splice(ts.tokenCount, extra.tokens.length); + } + } - } else if (tagHandle === '!') { - state.tag = '!' + tagName; + function isLexicalDeclaration() { + var lexical, ts; - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; + ts = tokenizerState(); - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } + lex(); + lexical = (lookahead.type === Token.Identifier) || match('[') || match('{') || + matchKeyword('let') || matchKeyword('yield'); - return true; -} + resetTokenizerState(ts); -function readAnchorProperty(state) { - var _position, - ch; + return lexical; + } - ch = state.input.charCodeAt(state.position); + function parseLexicalDeclaration(options) { + var kind, declarations, node = new Node(); - if (ch !== 0x26/* & */) return false; + kind = lex().value; + assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } + declarations = parseBindingList(kind, options); - ch = state.input.charCodeAt(++state.position); - _position = state.position; + consumeSemicolon(); - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } + return node.finishLexicalDeclaration(declarations, kind); + } - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } + function parseRestElement(params) { + var param, node = new Node(); - state.anchor = state.input.slice(_position, state.position); - return true; -} + lex(); -function readAlias(state) { - var _position, alias, - ch; + if (match('{')) { + throwError(Messages.ObjectPatternAsRestParameter); + } - ch = state.input.charCodeAt(state.position); + params.push(lookahead); - if (ch !== 0x2A/* * */) return false; + param = parseVariableIdentifier(); - ch = state.input.charCodeAt(++state.position); - _position = state.position; + if (match('=')) { + throwError(Messages.DefaultRestParameter); + } - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } + if (!match(')')) { + throwError(Messages.ParameterAfterRestParameter); + } - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } + return node.finishRestElement(param); + } - alias = state.input.slice(_position, state.position); + // ECMA-262 13.4 Empty Statement - if (!state.anchorMap.hasOwnProperty(alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } + function parseEmptyStatement(node) { + expect(';'); + return node.finishEmptyStatement(); + } - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} + // ECMA-262 12.4 Expression Statement -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } + test = parseExpression(); - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; + expect(')'); - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; + consequent = parseStatement(); + + if (matchKeyword('else')) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; } - } else { - allowBlockCollections = false; - } + + return node.finishIfStatement(test, consequent, alternate); } - } - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } + // ECMA-262 13.7 Iteration Statements - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } + function parseDoWhileStatement(node) { + var body, test, oldInIteration; - blockIndent = state.position - state.lineStart; + expectKeyword('do'); - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; + oldInIteration = state.inIteration; + state.inIteration = true; - } else if (readAlias(state)) { - hasContent = true; + body = parseStatement(); - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } + state.inIteration = oldInIteration; - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; + expectKeyword('while'); - if (state.tag === null) { - state.tag = '?'; - } - } + expect('('); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; + test = parseExpression(); + + expect(')'); + + if (match(';')) { + lex(); } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + + return node.finishDoWhileStatement(body, test); } - } - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; - typeIndex < typeQuantity; - typeIndex += 1) { - type = state.implicitTypes[typeIndex]; + function parseWhileStatement(node) { + var test, body, oldInIteration; - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only assigned to plain scalars. So, it isn't - // needed to check for 'kind' conformity. + expectKeyword('while'); - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty.call(state.typeMap, state.tag)) { - type = state.typeMap[state.tag]; + expect('('); - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } + test = parseExpression(); - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } + expect(')'); - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; -} + oldInIteration = state.inIteration; + state.inIteration = true; -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; + body = parseStatement(); - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; + state.inIteration = oldInIteration; - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); + return node.finishWhileStatement(test, body); + } - ch = state.input.charCodeAt(state.position); + function parseForStatement(node) { + var init, forIn, initSeq, initStartToken, test, update, left, right, kind, declarations, + body, oldInIteration, previousAllowIn = state.allowIn; - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } + init = test = update = null; + forIn = true; - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; + expectKeyword('for'); - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } + expect('('); - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; + if (match(';')) { + lex(); + } else { + if (matchKeyword('var')) { + init = new Node(); + lex(); + + state.allowIn = false; + declarations = parseVariableDeclarationList({ inFor: true }); + state.allowIn = previousAllowIn; + + if (declarations.length === 1 && matchKeyword('in')) { + init = init.finishVariableDeclaration(declarations); + lex(); + left = init; + right = parseExpression(); + init = null; + } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) { + init = init.finishVariableDeclaration(declarations); + lex(); + left = init; + right = parseAssignmentExpression(); + init = null; + forIn = false; + } else { + init = init.finishVariableDeclaration(declarations); + expect(';'); + } + } else if (matchKeyword('const') || matchKeyword('let')) { + init = new Node(); + kind = lex().value; + + if (!strict && lookahead.value === 'in') { + init = init.finishIdentifier(kind); + lex(); + left = init; + right = parseExpression(); + init = null; + } else { + state.allowIn = false; + declarations = parseBindingList(kind, {inFor: true}); + state.allowIn = previousAllowIn; + + if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) { + init = init.finishLexicalDeclaration(declarations, kind); + lex(); + left = init; + right = parseExpression(); + init = null; + } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) { + init = init.finishLexicalDeclaration(declarations, kind); + lex(); + left = init; + right = parseAssignmentExpression(); + init = null; + forIn = false; + } else { + consumeSemicolon(); + init = init.finishLexicalDeclaration(declarations, kind); + } + } + } else { + initStartToken = lookahead; + state.allowIn = false; + init = inheritCoverGrammar(parseAssignmentExpression); + state.allowIn = previousAllowIn; + + if (matchKeyword('in')) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInForIn); + } - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } + lex(); + reinterpretExpressionAsPattern(init); + left = init; + right = parseExpression(); + init = null; + } else if (matchContextualKeyword('of')) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInForLoop); + } - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } + lex(); + reinterpretExpressionAsPattern(init); + left = init; + right = parseAssignmentExpression(); + init = null; + forIn = false; + } else { + if (match(',')) { + initSeq = [init]; + while (match(',')) { + lex(); + initSeq.push(isolateCoverGrammar(parseAssignmentExpression)); + } + init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq); + } + expect(';'); + } + } + } - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } + if (typeof left === 'undefined') { - if (is_EOL(ch)) break; + if (!match(';')) { + test = parseExpression(); + } + expect(';'); - _position = state.position; + if (!match(')')) { + update = parseExpression(); + } + } - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } + expect(')'); - directiveArgs.push(state.input.slice(_position, state.position)); - } + oldInIteration = state.inIteration; + state.inIteration = true; - if (ch !== 0) readLineBreak(state); + body = isolateCoverGrammar(parseStatement); - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); + state.inIteration = oldInIteration; + + return (typeof left === 'undefined') ? + node.finishForStatement(init, test, update, body) : + forIn ? node.finishForInStatement(left, right, body) : + node.finishForOfStatement(left, right, body); } - } - skipSeparationSpace(state, true, -1); + // ECMA-262 13.8 The continue statement - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); + function parseContinueStatement(node) { + var label = null, key; - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } + expectKeyword('continue'); - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); + // Optimize the most common form: 'continue;'. + if (source.charCodeAt(startIndex) === 0x3B) { + lex(); - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } + if (!state.inIteration) { + throwError(Messages.IllegalContinue); + } - state.documents.push(state.result); + return node.finishContinueStatement(null); + } - if (state.position === state.lineStart && testDocumentSeparator(state)) { + if (hasLineTerminator) { + if (!state.inIteration) { + throwError(Messages.IllegalContinue); + } - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } + return node.finishContinueStatement(null); + } - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + key = '$' + label.name; + if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.UnknownLabel, label.name); + } + } -function loadDocuments(input, options) { - input = String(input); - options = options || {}; + consumeSemicolon(); - if (input.length !== 0) { + if (label === null && !state.inIteration) { + throwError(Messages.IllegalContinue); + } - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; + return node.finishContinueStatement(label); } - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } + // ECMA-262 13.9 The break statement - var state = new State(input, options); + function parseBreakStatement(node) { + var label = null, key; - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; + expectKeyword('break'); - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(lastIndex) === 0x3B) { + lex(); - while (state.position < (state.length - 1)) { - readDocument(state); - } + if (!(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } - return state.documents; -} + return node.finishBreakStatement(null); + } + if (hasLineTerminator) { + if (!(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + } else if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); -function loadAll(input, iterator, options) { - var documents = loadDocuments(input, options), index, length; + key = '$' + label.name; + if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.UnknownLabel, label.name); + } + } - for (index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} + consumeSemicolon(); + if (label === null && !(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } -function load(input, options) { - var documents = loadDocuments(input, options); + return node.finishBreakStatement(label); + } - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new YAMLException('expected a single document in the stream, but found more'); -} + // ECMA-262 13.10 The return statement + function parseReturnStatement(node) { + var argument = null; -function safeLoadAll(input, output, options) { - loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} + expectKeyword('return'); + if (!state.inFunctionBody) { + tolerateError(Messages.IllegalReturn); + } -function safeLoad(input, options) { - return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} + // 'return' followed by a space and an identifier is very common. + if (source.charCodeAt(lastIndex) === 0x20) { + if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) { + argument = parseExpression(); + consumeSemicolon(); + return node.finishReturnStatement(argument); + } + } + if (hasLineTerminator) { + // HACK + return node.finishReturnStatement(null); + } -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; + if (!match(';')) { + if (!match('}') && lookahead.type !== Token.EOF) { + argument = parseExpression(); + } + } -},{"./common":25,"./exception":27,"./mark":29,"./schema/default_full":32,"./schema/default_safe":33}],29:[function(require,module,exports){ -'use strict'; + consumeSemicolon(); + return node.finishReturnStatement(argument); + } -var common = require('./common'); + // ECMA-262 13.11 The with statement + function parseWithStatement(node) { + var object, body; -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; -} + if (strict) { + tolerateError(Messages.StrictModeWith); + } + expectKeyword('with'); -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; + expect('('); - if (!this.buffer) return null; + object = parseExpression(); - indent = indent || 4; - maxLength = maxLength || 75; + expect(')'); - head = ''; - start = this.position; + body = parseStatement(); - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; + return node.finishWithStatement(object, body); } - } - tail = ''; - end = this.position; + // ECMA-262 13.12 The switch statement - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; + function parseSwitchCase() { + var test, consequent = [], statement, node = new Node(); + + if (matchKeyword('default')) { + lex(); + test = null; + } else { + expectKeyword('case'); + test = parseExpression(); + } + expect(':'); + + while (startIndex < length) { + if (match('}') || matchKeyword('default') || matchKeyword('case')) { + break; + } + statement = parseStatementListItem(); + consequent.push(statement); + } + + return node.finishSwitchCase(test, consequent); } - } - snippet = this.buffer.slice(start, end); + function parseSwitchStatement(node) { + var discriminant, cases, clause, oldInSwitch, defaultFound; - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; + expectKeyword('switch'); + expect('('); -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; + discriminant = parseExpression(); - if (this.name) { - where += 'in "' + this.name + '" '; - } + expect(')'); - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + expect('{'); - if (!compact) { - snippet = this.getSnippet(); + cases = []; - if (snippet) { - where += ':\n' + snippet; + if (match('}')) { + lex(); + return node.finishSwitchStatement(discriminant, cases); + } + + oldInSwitch = state.inSwitch; + state.inSwitch = true; + defaultFound = false; + + while (startIndex < length) { + if (match('}')) { + break; + } + clause = parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + throwError(Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + + state.inSwitch = oldInSwitch; + + expect('}'); + + return node.finishSwitchStatement(discriminant, cases); } - } - return where; -}; + // ECMA-262 13.14 The throw statement + function parseThrowStatement(node) { + var argument; -module.exports = Mark; + expectKeyword('throw'); -},{"./common":25}],30:[function(require,module,exports){ -'use strict'; + if (hasLineTerminator) { + throwError(Messages.NewlineAfterThrow); + } -/*eslint-disable max-len*/ + argument = parseExpression(); -var common = require('./common'); -var YAMLException = require('./exception'); -var Type = require('./type'); + consumeSemicolon(); + return node.finishThrowStatement(argument); + } -function compileList(schema, name, result) { - var exclude = []; + // ECMA-262 13.15 The try statement - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); + function parseCatchClause() { + var param, params = [], paramMap = {}, key, i, body, node = new Node(); - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag) { - exclude.push(previousIndex); - } - }); + expectKeyword('catch'); - result.push(currentType); - }); + expect('('); + if (match(')')) { + throwUnexpectedToken(lookahead); + } - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); -} + param = parsePattern(params); + for (i = 0; i < params.length; i++) { + key = '$' + params[i].value; + if (Object.prototype.hasOwnProperty.call(paramMap, key)) { + tolerateError(Messages.DuplicateBinding, params[i].value); + } + paramMap[key] = true; + } + // ECMA-262 12.14.1 + if (strict && isRestrictedWord(param.name)) { + tolerateError(Messages.StrictCatchVariable); + } -function compileMap(/* lists... */) { - var result = {}, index, length; + expect(')'); + body = parseBlock(); + return node.finishCatchClause(param, body); + } - function collectType(type) { - result[type.tag] = type; - } + function parseTryStatement(node) { + var block, handler = null, finalizer = null; - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } + expectKeyword('try'); - return result; -} + block = parseBlock(); + if (matchKeyword('catch')) { + handler = parseCatchClause(); + } -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; + if (matchKeyword('finally')) { + lex(); + finalizer = parseBlock(); + } - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + if (!handler && !finalizer) { + throwError(Messages.NoCatchOrFinally); + } + + return node.finishTryStatement(block, handler, finalizer); } - }); - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} + // ECMA-262 13.16 The debugger statement + function parseDebuggerStatement(node) { + expectKeyword('debugger'); -Schema.DEFAULT = null; + consumeSemicolon(); + return node.finishDebuggerStatement(); + } -Schema.create = function createSchema() { - var schemas, types; + // 13 Statements - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; + function parseStatement() { + var type = lookahead.type, + expr, + labeledBody, + key, + node; - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; + if (type === Token.EOF) { + throwUnexpectedToken(lookahead); + } - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); - } + if (type === Token.Punctuator && lookahead.value === '{') { + return parseBlock(); + } + isAssignmentTarget = isBindingElement = true; + node = new Node(); - schemas = common.toArray(schemas); - types = common.toArray(types); + if (type === Token.Punctuator) { + switch (lookahead.value) { + case ';': + return parseEmptyStatement(node); + case '(': + return parseExpressionStatement(node); + default: + break; + } + } else if (type === Token.Keyword) { + switch (lookahead.value) { + case 'break': + return parseBreakStatement(node); + case 'continue': + return parseContinueStatement(node); + case 'debugger': + return parseDebuggerStatement(node); + case 'do': + return parseDoWhileStatement(node); + case 'for': + return parseForStatement(node); + case 'function': + return parseFunctionDeclaration(node); + case 'if': + return parseIfStatement(node); + case 'return': + return parseReturnStatement(node); + case 'switch': + return parseSwitchStatement(node); + case 'throw': + return parseThrowStatement(node); + case 'try': + return parseTryStatement(node); + case 'var': + return parseVariableStatement(node); + case 'while': + return parseWhileStatement(node); + case 'with': + return parseWithStatement(node); + default: + break; + } + } - if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); - } + expr = parseExpression(); - if (!types.every(function (type) { return type instanceof Type; })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } + // ECMA-262 12.12 Labelled Statements + if ((expr.type === Syntax.Identifier) && match(':')) { + lex(); - return new Schema({ - include: schemas, - explicit: types - }); -}; + key = '$' + expr.name; + if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.Redeclaration, 'Label', expr.name); + } + state.labelSet[key] = true; + labeledBody = parseStatement(); + delete state.labelSet[key]; + return node.finishLabeledStatement(expr, labeledBody); + } -module.exports = Schema; + consumeSemicolon(); -},{"./common":25,"./exception":27,"./type":36}],31:[function(require,module,exports){ -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. + return node.finishExpressionStatement(expr); + } + // ECMA-262 14.1 Function Definition -'use strict'; + function parseFunctionSourceElements() { + var statement, body = [], token, directive, firstRestricted, + oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount, + node = new Node(); + expect('{'); -var Schema = require('../schema'); + while (startIndex < length) { + if (lookahead.type !== Token.StringLiteral) { + break; + } + token = lookahead; + statement = parseStatementListItem(); + body.push(statement); + if (statement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = source.slice(token.start + 1, token.end - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } -module.exports = new Schema({ - include: [ - require('./json') - ] -}); + oldLabelSet = state.labelSet; + oldInIteration = state.inIteration; + oldInSwitch = state.inSwitch; + oldInFunctionBody = state.inFunctionBody; + oldParenthesisCount = state.parenthesizedCount; -},{"../schema":30,"./json":35}],32:[function(require,module,exports){ -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. + state.labelSet = {}; + state.inIteration = false; + state.inSwitch = false; + state.inFunctionBody = true; + state.parenthesizedCount = 0; + while (startIndex < length) { + if (match('}')) { + break; + } + body.push(parseStatementListItem()); + } -'use strict'; + expect('}'); + state.labelSet = oldLabelSet; + state.inIteration = oldInIteration; + state.inSwitch = oldInSwitch; + state.inFunctionBody = oldInFunctionBody; + state.parenthesizedCount = oldParenthesisCount; -var Schema = require('../schema'); + return node.finishBlockStatement(body); + } + function validateParam(options, param, name) { + var key = '$' + name; + if (strict) { + if (isRestrictedWord(name)) { + options.stricted = param; + options.message = Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = Messages.StrictParamDupe; + } + } else if (!options.firstRestricted) { + if (isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = Messages.StrictParamDupe; + } + } + options.paramSet[key] = true; + } -module.exports = Schema.DEFAULT = new Schema({ - include: [ - require('./default_safe') - ], - explicit: [ - require('../type/js/undefined'), - require('../type/js/regexp'), - require('../type/js/function') - ] -}); + function parseParam(options) { + var token, param, params = [], i, def; -},{"../schema":30,"../type/js/function":41,"../type/js/regexp":42,"../type/js/undefined":43,"./default_safe":33}],33:[function(require,module,exports){ -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) + token = lookahead; + if (token.value === '...') { + param = parseRestElement(params); + validateParam(options, param.argument, param.argument.name); + options.params.push(param); + options.defaults.push(null); + return false; + } + param = parsePatternWithDefault(params); + for (i = 0; i < params.length; i++) { + validateParam(options, params[i], params[i].value); + } -'use strict'; + if (param.type === Syntax.AssignmentPattern) { + def = param.right; + param = param.left; + ++options.defaultCount; + } + options.params.push(param); + options.defaults.push(def); -var Schema = require('../schema'); + return !match(')'); + } + function parseParams(firstRestricted) { + var options; -module.exports = new Schema({ - include: [ - require('./core') - ], - implicit: [ - require('../type/timestamp'), - require('../type/merge') - ], - explicit: [ - require('../type/binary'), - require('../type/omap'), - require('../type/pairs'), - require('../type/set') - ] -}); + options = { + params: [], + defaultCount: 0, + defaults: [], + firstRestricted: firstRestricted + }; -},{"../schema":30,"../type/binary":37,"../type/merge":45,"../type/omap":47,"../type/pairs":48,"../type/set":50,"../type/timestamp":52,"./core":31}],34:[function(require,module,exports){ -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 + expect('('); + if (!match(')')) { + options.paramSet = {}; + while (startIndex < length) { + if (!parseParam(options)) { + break; + } + expect(','); + } + } -'use strict'; + expect(')'); + if (options.defaultCount === 0) { + options.defaults = []; + } -var Schema = require('../schema'); + return { + params: options.params, + defaults: options.defaults, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + } + function parseFunctionDeclaration(node, identifierIsOptional) { + var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict, + isGenerator, previousAllowYield; -module.exports = new Schema({ - explicit: [ - require('../type/str'), - require('../type/seq'), - require('../type/map') - ] -}); + previousAllowYield = state.allowYield; -},{"../schema":30,"../type/map":44,"../type/seq":49,"../type/str":51}],35:[function(require,module,exports){ -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + expectKeyword('function'); + isGenerator = match('*'); + if (isGenerator) { + lex(); + } -'use strict'; + if (!identifierIsOptional || !match('(')) { + token = lookahead; + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + state.allowYield = !isGenerator; + tmp = parseParams(firstRestricted); + params = tmp.params; + defaults = tmp.defaults; + stricted = tmp.stricted; + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } -var Schema = require('../schema'); + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwUnexpectedToken(firstRestricted, message); + } + if (strict && stricted) { + tolerateUnexpectedToken(stricted, message); + } -module.exports = new Schema({ - include: [ - require('./failsafe') - ], - implicit: [ - require('../type/null'), - require('../type/bool'), - require('../type/int'), - require('../type/float') - ] -}); + strict = previousStrict; + state.allowYield = previousAllowYield; -},{"../schema":30,"../type/bool":38,"../type/float":39,"../type/int":40,"../type/null":46,"./failsafe":34}],36:[function(require,module,exports){ -'use strict'; + return node.finishFunctionDeclaration(id, params, defaults, body, isGenerator); + } -var YAMLException = require('./exception'); + function parseFunctionExpression() { + var token, id = null, stricted, firstRestricted, message, tmp, + params = [], defaults = [], body, previousStrict, node = new Node(), + isGenerator, previousAllowYield; -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; + previousAllowYield = state.allowYield; -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; + expectKeyword('function'); -function compileStyleAliases(map) { - var result = {}; + isGenerator = match('*'); + if (isGenerator) { + lex(); + } - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } + state.allowYield = !isGenerator; + if (!match('(')) { + token = lookahead; + id = (!strict && !isGenerator && matchKeyword('yield')) ? parseNonComputedProperty() : parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } - return result; -} + tmp = parseParams(firstRestricted); + params = tmp.params; + defaults = tmp.defaults; + stricted = tmp.stricted; + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } -function Type(tag, options) { - options = options || {}; + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwUnexpectedToken(firstRestricted, message); + } + if (strict && stricted) { + tolerateUnexpectedToken(stricted, message); + } + strict = previousStrict; + state.allowYield = previousAllowYield; - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + return node.finishFunctionExpression(id, params, defaults, body, isGenerator); } - }); - - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} + // ECMA-262 14.5 Class Definitions -module.exports = Type; + function parseClassBody() { + var classBody, token, isStatic, hasConstructor = false, body, method, computed, key; -},{"./exception":27}],37:[function(require,module,exports){ -'use strict'; + classBody = new Node(); -/*eslint-disable no-bitwise*/ - -// A trick for browserified version. -// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined -var NodeBuffer = require('buffer').Buffer; -var Type = require('../type'); + expect('{'); + body = []; + while (!match('}')) { + if (match(';')) { + lex(); + } else { + method = new Node(); + token = lookahead; + isStatic = false; + computed = match('['); + if (match('*')) { + lex(); + } else { + key = parseObjectPropertyKey(); + if (key.name === 'static' && (lookaheadPropertyName() || match('*'))) { + token = lookahead; + isStatic = true; + computed = match('['); + if (match('*')) { + lex(); + } else { + key = parseObjectPropertyKey(); + } + } + } + method = tryParseMethodDefinition(token, key, computed, method); + if (method) { + method['static'] = isStatic; // jscs:ignore requireDotNotation + if (method.kind === 'init') { + method.kind = 'method'; + } + if (!isStatic) { + if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') { + if (method.kind !== 'method' || !method.method || method.value.generator) { + throwUnexpectedToken(token, Messages.ConstructorSpecialMethod); + } + if (hasConstructor) { + throwUnexpectedToken(token, Messages.DuplicateConstructor); + } else { + hasConstructor = true; + } + method.kind = 'constructor'; + } + } else { + if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') { + throwUnexpectedToken(token, Messages.StaticPrototype); + } + } + method.type = Syntax.MethodDefinition; + delete method.method; + delete method.shorthand; + body.push(method); + } else { + throwUnexpectedToken(lookahead); + } + } + } + lex(); + return classBody.finishClassBody(body); + } + function parseClassDeclaration(identifierIsOptional) { + var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; + strict = true; -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + expectKeyword('class'); + if (!identifierIsOptional || lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } -function resolveYamlBinary(data) { - if (data === null) return false; + if (matchKeyword('extends')) { + lex(); + superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); + } + classBody = parseClassBody(); + strict = previousStrict; - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + return classNode.finishClassDeclaration(id, superClass, classBody); + } - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); + function parseClassExpression() { + var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; + strict = true; - // Skip CR/LF - if (code > 64) continue; + expectKeyword('class'); - // Fail on illegal characters - if (code < 0) return false; + if (lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } - bitlen += 6; - } + if (matchKeyword('extends')) { + lex(); + superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); + } + classBody = parseClassBody(); + strict = previousStrict; - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} + return classNode.finishClassExpression(id, superClass, classBody); + } -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; + // ECMA-262 15.2 Modules - // Collect by 6*4 bits (3 bytes) + function parseModuleSpecifier() { + var node = new Node(); - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); + if (lookahead.type !== Token.StringLiteral) { + throwError(Messages.InvalidModuleSpecifier); + } + return node.finishLiteral(lex()); } - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } - - // Dump tail + // ECMA-262 15.2.3 Exports - tailbits = (max % 4) * 6; + function parseExportSpecifier() { + var exported, local, node = new Node(), def; + if (matchKeyword('default')) { + // export {default} from 'something'; + def = new Node(); + lex(); + local = def.finishIdentifier('default'); + } else { + local = parseVariableIdentifier(); + } + if (matchContextualKeyword('as')) { + lex(); + exported = parseNonComputedProperty(); + } + return node.finishExportSpecifier(local, exported); + } + + function parseExportNamedDeclaration(node) { + var declaration = null, + isExportFromIdentifier, + src = null, specifiers = []; + + // non-default export + if (lookahead.type === Token.Keyword) { + // covers: + // export var f = 1; + switch (lookahead.value) { + case 'let': + case 'const': + declaration = parseLexicalDeclaration({inFor: false}); + return node.finishExportNamedDeclaration(declaration, specifiers, null); + case 'var': + case 'class': + case 'function': + declaration = parseStatementListItem(); + return node.finishExportNamedDeclaration(declaration, specifiers, null); + } + } - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } + expect('{'); + while (!match('}')) { + isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default'); + specifiers.push(parseExportSpecifier()); + if (!match('}')) { + expect(','); + if (match('}')) { + break; + } + } + } + expect('}'); + + if (matchContextualKeyword('from')) { + // covering: + // export {default} from 'foo'; + // export {foo} from 'foo'; + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + } else if (isExportFromIdentifier) { + // covering: + // export {default}; // missing fromClause + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } else { + // cover + // export {foo}; + consumeSemicolon(); + } + return node.finishExportNamedDeclaration(declaration, specifiers, src); + } - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) return new NodeBuffer(result); + function parseExportDefaultDeclaration(node) { + var declaration = null, + expression = null; - return result; -} + // covers: + // export default ... + expectKeyword('default'); -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; + if (matchKeyword('function')) { + // covers: + // export default function foo () {} + // export default function () {} + declaration = parseFunctionDeclaration(new Node(), true); + return node.finishExportDefaultDeclaration(declaration); + } + if (matchKeyword('class')) { + declaration = parseClassDeclaration(true); + return node.finishExportDefaultDeclaration(declaration); + } - // Convert every three bytes to 4 ASCII characters. + if (matchContextualKeyword('from')) { + throwError(Messages.UnexpectedToken, lookahead.value); + } - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; + // covers: + // export default {}; + // export default []; + // export default (1 + 2); + if (match('{')) { + expression = parseObjectInitializer(); + } else if (match('[')) { + expression = parseArrayInitializer(); + } else { + expression = parseAssignmentExpression(); + } + consumeSemicolon(); + return node.finishExportDefaultDeclaration(expression); } - bits = (bits << 8) + object[idx]; - } + function parseExportAllDeclaration(node) { + var src; - // Dump tail + // covers: + // export * from 'foo'; + expect('*'); + if (!matchContextualKeyword('from')) { + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); - tail = max % 3; + return node.finishExportAllDeclaration(src); + } - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } + function parseExportDeclaration() { + var node = new Node(); + if (state.inFunctionBody) { + throwError(Messages.IllegalExportDeclaration); + } - return result; -} + expectKeyword('export'); -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} + if (matchKeyword('default')) { + return parseExportDefaultDeclaration(node); + } + if (match('*')) { + return parseExportAllDeclaration(node); + } + return parseExportNamedDeclaration(node); + } -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); + // ECMA-262 15.2.2 Imports -},{"../type":36,"buffer":8}],38:[function(require,module,exports){ -'use strict'; + function parseImportSpecifier() { + // import {} ...; + var local, imported, node = new Node(); -var Type = require('../type'); + imported = parseNonComputedProperty(); + if (matchContextualKeyword('as')) { + lex(); + local = parseVariableIdentifier(); + } -function resolveYamlBoolean(data) { - if (data === null) return false; + return node.finishImportSpecifier(local, imported); + } - var max = data.length; + function parseNamedImports() { + var specifiers = []; + // {foo, bar as bas} + expect('{'); + while (!match('}')) { + specifiers.push(parseImportSpecifier()); + if (!match('}')) { + expect(','); + if (match('}')) { + break; + } + } + } + expect('}'); + return specifiers; + } - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} + function parseImportDefaultSpecifier() { + // import ...; + var local, node = new Node(); -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} + local = parseNonComputedProperty(); -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} + return node.finishImportDefaultSpecifier(local); + } -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); + function parseImportNamespaceSpecifier() { + // import <* as foo> ...; + var local, node = new Node(); -},{"../type":36}],39:[function(require,module,exports){ -'use strict'; + expect('*'); + if (!matchContextualKeyword('as')) { + throwError(Messages.NoAsAfterImportNamespace); + } + lex(); + local = parseNonComputedProperty(); -var common = require('../common'); -var Type = require('../type'); + return node.finishImportNamespaceSpecifier(local); + } -var YAML_FLOAT_PATTERN = new RegExp( - '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' + - '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' + - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - '|[-+]?\\.(?:inf|Inf|INF)' + - '|\\.(?:nan|NaN|NAN))$'); + function parseImportDeclaration() { + var specifiers = [], src, node = new Node(); -function resolveYamlFloat(data) { - if (data === null) return false; + if (state.inFunctionBody) { + throwError(Messages.IllegalImportDeclaration); + } - if (!YAML_FLOAT_PATTERN.test(data)) return false; + expectKeyword('import'); - return true; -} + if (lookahead.type === Token.StringLiteral) { + // import 'foo'; + src = parseModuleSpecifier(); + } else { -function constructYamlFloat(data) { - var value, sign, base, digits; + if (match('{')) { + // import {bar} + specifiers = specifiers.concat(parseNamedImports()); + } else if (match('*')) { + // import * as foo + specifiers.push(parseImportNamespaceSpecifier()); + } else if (isIdentifierName(lookahead) && !matchKeyword('default')) { + // import foo + specifiers.push(parseImportDefaultSpecifier()); + if (match(',')) { + lex(); + if (match('*')) { + // import foo, * as foo + specifiers.push(parseImportNamespaceSpecifier()); + } else if (match('{')) { + // import foo, {bar} + specifiers = specifiers.concat(parseNamedImports()); + } else { + throwUnexpectedToken(lookahead); + } + } + } else { + throwUnexpectedToken(lex()); + } - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; + if (!matchContextualKeyword('from')) { + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + } - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } + consumeSemicolon(); + return node.finishImportDeclaration(specifiers, src); + } - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + // ECMA-262 15.1 Scripts - } else if (value === '.nan') { - return NaN; + function parseScriptBody() { + var statement, body = [], token, directive, firstRestricted; - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); + while (startIndex < length) { + token = lookahead; + if (token.type !== Token.StringLiteral) { + break; + } - value = 0.0; - base = 1; + statement = parseStatementListItem(); + body.push(statement); + if (statement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = source.slice(token.start + 1, token.end - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); + while (startIndex < length) { + statement = parseStatementListItem(); + /* istanbul ignore if */ + if (typeof statement === 'undefined') { + break; + } + body.push(statement); + } + return body; + } - return sign * value; + function parseProgram() { + var body, node; - } - return sign * parseFloat(value, 10); -} + peek(); + node = new Node(); + body = parseScriptBody(); + return node.finishProgram(body, state.sourceType); + } -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + function filterTokenLocation() { + var i, entry, token, tokens = []; -function representYamlFloat(object, style) { - var res; + for (i = 0; i < extra.tokens.length; ++i) { + entry = extra.tokens[i]; + token = { + type: entry.type, + value: entry.value + }; + if (entry.regex) { + token.regex = { + pattern: entry.regex.pattern, + flags: entry.regex.flags + }; + } + if (extra.range) { + token.range = entry.range; + } + if (extra.loc) { + token.loc = entry.loc; + } + tokens.push(token); + } + + extra.tokens = tokens; + } + + function tokenize(code, options, delegate) { + var toString, + tokens; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + length = source.length; + lookahead = null; + state = { + allowIn: true, + allowYield: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + curlyStack: [] + }; - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } + extra = {}; - res = object.toString(10); + // Options matching. + options = options || {}; - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack + // Of course we collect tokens here. + options.tokens = true; + extra.tokens = []; + extra.tokenValues = []; + extra.tokenize = true; + extra.delegate = delegate; - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} + // The following two fields are necessary to compute the Regex tokens. + extra.openParenToken = -1; + extra.openCurlyToken = -1; -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); -} + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; -module.exports = new Type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } -},{"../common":25,"../type":36}],40:[function(require,module,exports){ -'use strict'; + try { + peek(); + if (lookahead.type === Token.EOF) { + return extra.tokens; + } -var common = require('../common'); -var Type = require('../type'); + lex(); + while (lookahead.type !== Token.EOF) { + try { + lex(); + } catch (lexError) { + if (extra.errors) { + recordError(lexError); + // We have to break on the first error + // to avoid infinite loops. + break; + } else { + throw lexError; + } + } + } -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} + tokens = extra.tokens; + if (typeof extra.errors !== 'undefined') { + tokens.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + return tokens; + } + + function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + length = source.length; + lookahead = null; + state = { + allowIn: true, + allowYield: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + curlyStack: [], + sourceType: 'script' + }; + strict = false; -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} + extra = {}; + if (typeof options !== 'undefined') { + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment; -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); -} + if (extra.loc && options.source !== null && options.source !== undefined) { + extra.source = toString(options.source); + } -function resolveYamlInteger(data) { - if (data === null) return false; + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + if (extra.attachComment) { + extra.range = true; + extra.comments = []; + extra.bottomRightStack = []; + extra.trailingComments = []; + extra.leadingComments = []; + } + if (options.sourceType === 'module') { + // very restrictive condition for now + state.sourceType = options.sourceType; + strict = true; + } + } - var max = data.length, - index = 0, - hasDigits = false, - ch; + try { + program = parseProgram(); + if (typeof extra.comments !== 'undefined') { + program.comments = extra.comments; + } + if (typeof extra.tokens !== 'undefined') { + filterTokenLocation(); + program.tokens = extra.tokens; + } + if (typeof extra.errors !== 'undefined') { + program.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } - if (!max) return false; + return program; + } - ch = data[index]; + // Sync with *.json manifests. + exports.version = '2.7.1'; - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } + exports.tokenize = tokenize; - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; + exports.parse = parse; - // base 2, base 8, base 16 + // Deep copy. + /* istanbul ignore next */ + exports.Syntax = (function () { + var name, types = {}; - if (ch === 'b') { - // base 2 - index++; + if (typeof Object.create === 'function') { + types = Object.create(null); + } - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits; - } + for (name in Syntax) { + if (Syntax.hasOwnProperty(name)) { + types[name] = Syntax[name]; + } + } + if (typeof Object.freeze === 'function') { + Object.freeze(types); + } - if (ch === 'x') { - // base 16 - index++; + return types; + }()); - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits; - } +})); +/* vim: set sw=4 ts=4 et tw=80 : */ - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits; - } +},{}],19:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - // base 10 (except 0) or base 60 +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; - if (!hasDigits) return false; +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; - // if !base60 - done; - if (ch !== ':') return true; +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } + throw TypeError('Uncaught, unspecified "error" event.'); + } } - ch = value[0]; + handler = this._events[type]; - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); } - if (value === '0') return 0; + return true; +}; - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } +EventEmitter.prototype.addListener = function(type, listener) { + var m; - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); + if (!isFunction(listener)) + throw TypeError('listener must be a function'); - value = 0; - base = 1; + if (!this._events) + this._events = {}; - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); - return sign * value; + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } } - return sign * parseInt(value, 10); -} + return this; +}; -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} +EventEmitter.prototype.on = EventEmitter.prototype.addListener; -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (object) { return '0b' + object.toString(2); }, - octal: function (object) { return '0' + object.toString(8); }, - decimal: function (object) { return object.toString(10); }, - hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - -},{"../common":25,"../type":36}],41:[function(require,module,exports){ -'use strict'; - -var esprima; - -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require = require; - esprima = _require('esprima'); -} catch (_) { - /*global window */ - if (typeof window !== 'undefined') esprima = window.esprima; -} - -var Type = require('../../type'); +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); -function resolveJavascriptFunction(data) { - if (data === null) return false; + var fired = false; - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); + function g() { + this.removeListener(type, g); - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - ast.body[0].expression.type !== 'FunctionExpression') { - return false; + if (!fired) { + fired = true; + listener.apply(this, arguments); } - - return true; - } catch (err) { - return false; } -} -function constructJavascriptFunction(data) { - /*jslint evil:true*/ + g.listener = listener; + this.on(type, g); - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; + return this; +}; - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - ast.body[0].expression.type !== 'FunctionExpression') { - throw new Error('Failed to resolve function'); - } +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); + if (!isFunction(listener)) + throw TypeError('listener must be a function'); - body = ast.body[0].expression.body.range; + if (!this._events || !this._events[type]) + return this; - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); -} + list = this._events[type]; + length = list.length; + position = -1; -function representJavascriptFunction(object /*, style*/) { - return object.toString(); -} + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } -module.exports = new Type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); + if (position < 0) + return this; -},{"../../type":36}],42:[function(require,module,exports){ -'use strict'; + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } -var Type = require('../../type'); + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; + return this; +}; - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; + if (!this._events) + return this; - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; } - return true; -} - -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; } - return new RegExp(regexp, modifiers); -} - -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; + listeners = this._events[type]; - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; - return result; -} + return this; +}; -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; -module.exports = new Type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; -},{"../../type":36}],43:[function(require,module,exports){ -'use strict'; + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; -var Type = require('../../type'); +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; -function resolveJavascriptUndefined() { - return true; +function isFunction(arg) { + return typeof arg === 'function'; } -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; +function isNumber(arg) { + return typeof arg === 'number'; } -function representJavascriptUndefined() { - return ''; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; } -function isUndefined(object) { - return typeof object === 'undefined'; +function isUndefined(arg) { + return arg === void 0; } -module.exports = new Type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); - -},{"../../type":36}],44:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); +},{}],20:[function(require,module,exports){ +var http = require('http'); -module.exports = new Type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); +var https = module.exports; -},{"../type":36}],45:[function(require,module,exports){ -'use strict'; +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; +}; -var Type = require('../type'); +https.request = function (params, cb) { + if (!params) params = {}; + params.scheme = 'https'; + params.protocol = 'https:'; + return http.request.call(this, params, cb); +} -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} +},{"http":93}],21:[function(require,module,exports){ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] -module.exports = new Type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); + i += d -},{"../type":36}],46:[function(require,module,exports){ -'use strict'; + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} -var Type = require('../type'); + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} -function resolveYamlNull(data) { - if (data === null) return true; + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} - var max = data.length; +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} + value = Math.abs(value) -function constructYamlNull() { - return null; -} + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } -function isNull(object) { - return object === null; -} + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } -module.exports = new Type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } - }, - defaultStyle: 'lowercase' -}); + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} -},{"../type":36}],47:[function(require,module,exports){ -'use strict'; + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} -var Type = require('../type'); + buffer[offset + i - d] |= s * 128 +} -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; +},{}],22:[function(require,module,exports){ +/*! + * node-inherit + * Copyright(c) 2011 Dmitry Filatov + * MIT Licensed + */ -function resolveYamlOmap(data) { - if (data === null) return true; +module.exports = require('./lib/inherit'); - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; +},{"./lib/inherit":23}],23:[function(require,module,exports){ +/** + * @module inherit + * @version 2.2.2 + * @author Filatov Dmitry + * @description This module provides some syntax sugar for "class" declarations, constructors, mixins, "super" calls and static members. + */ - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; +(function(global) { - if (_toString.call(pair) !== '[object Object]') return false; +var hasIntrospection = (function(){'_';}).toString().indexOf('_') > -1, + emptyBase = function() {}, + hasOwnProperty = Object.prototype.hasOwnProperty, + objCreate = Object.create || function(ptp) { + var inheritance = function() {}; + inheritance.prototype = ptp; + return new inheritance(); + }, + objKeys = Object.keys || function(obj) { + var res = []; + for(var i in obj) { + hasOwnProperty.call(obj, i) && res.push(i); + } + return res; + }, + extend = function(o1, o2) { + for(var i in o2) { + hasOwnProperty.call(o2, i) && (o1[i] = o2[i]); + } - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } + return o1; + }, + toStr = Object.prototype.toString, + isArray = Array.isArray || function(obj) { + return toStr.call(obj) === '[object Array]'; + }, + isFunction = function(obj) { + return toStr.call(obj) === '[object Function]'; + }, + noOp = function() {}, + needCheckProps = true, + testPropObj = { toString : '' }; - if (!pairHasKey) return false; +for(var i in testPropObj) { // fucking ie hasn't toString, valueOf in for + testPropObj.hasOwnProperty(i) && (needCheckProps = false); +} - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } +var specProps = needCheckProps? ['toString', 'valueOf'] : null; - return true; +function getPropList(obj) { + var res = objKeys(obj); + if(needCheckProps) { + var specProp, i = 0; + while(specProp = specProps[i++]) { + obj.hasOwnProperty(specProp) && res.push(specProp); + } + } + + return res; } -function constructYamlOmap(data) { - return data !== null ? data : []; +function override(base, res, add) { + var addList = getPropList(add), + j = 0, len = addList.length, + name, prop; + while(j < len) { + if((name = addList[j++]) === '__self') { + continue; + } + prop = add[name]; + if(isFunction(prop) && + (!hasIntrospection || prop.toString().indexOf('.__base') > -1)) { + res[name] = (function(name, prop) { + var baseMethod = base[name]? + base[name] : + name === '__constructor'? // case of inheritance from plane function + res.__self.__parent : + noOp; + return function() { + var baseSaved = this.__base; + this.__base = baseMethod; + var res = prop.apply(this, arguments); + this.__base = baseSaved; + return res; + }; + })(name, prop); + } else { + res[name] = prop; + } + } } -module.exports = new Type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); +function applyMixins(mixins, res) { + var i = 1, mixin; + while(mixin = mixins[i++]) { + res? + isFunction(mixin)? + inherit.self(res, mixin.prototype, mixin) : + inherit.self(res, mixin) : + res = isFunction(mixin)? + inherit(mixins[0], mixin.prototype, mixin) : + inherit(mixins[0], mixin); + } + return res || mixins[0]; +} -},{"../type":36}],48:[function(require,module,exports){ -'use strict'; +/** +* Creates class +* @exports +* @param {Function|Array} [baseClass|baseClassAndMixins] class (or class and mixins) to inherit from +* @param {Object} prototypeFields +* @param {Object} [staticFields] +* @returns {Function} class +*/ +function inherit() { + var args = arguments, + withMixins = isArray(args[0]), + hasBase = withMixins || isFunction(args[0]), + base = hasBase? withMixins? applyMixins(args[0]) : args[0] : emptyBase, + props = args[hasBase? 1 : 0] || {}, + staticProps = args[hasBase? 2 : 1], + res = props.__constructor || (hasBase && base.prototype.__constructor)? + function() { + return this.__constructor.apply(this, arguments); + } : + hasBase? + function() { + return base.apply(this, arguments); + } : + function() {}; -var Type = require('../type'); + if(!hasBase) { + res.prototype = props; + res.prototype.__self = res.prototype.constructor = res; + return extend(res, staticProps); + } -var _toString = Object.prototype.toString; + extend(res, base); -function resolveYamlPairs(data) { - if (data === null) return true; + res.__parent = base; - var index, length, pair, keys, result, - object = data; + var basePtp = base.prototype, + resPtp = res.prototype = objCreate(basePtp); - result = new Array(object.length); + resPtp.__self = resPtp.constructor = res; - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; + props && override(basePtp, resPtp, props); + staticProps && override(base, res, staticProps); - if (_toString.call(pair) !== '[object Object]') return false; + return res; +} - keys = Object.keys(pair); +inherit.self = function() { + var args = arguments, + withMixins = isArray(args[0]), + base = withMixins? applyMixins(args[0], args[0][0]) : args[0], + props = args[1], + staticProps = args[2], + basePtp = base.prototype; - if (keys.length !== 1) return false; + props && override(basePtp, basePtp, props); + staticProps && override(base, base, staticProps); - result[index] = [ keys[0], pair[keys[0]] ]; - } + return base; +}; - return true; +var defineAsGlobal = true; +if(typeof exports === 'object') { + module.exports = inherit; + defineAsGlobal = false; } -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; +if(typeof modules === 'object') { + modules.define('inherit', function(provide) { + provide(inherit); + }); + defineAsGlobal = false; +} - result = new Array(object.length); +if(typeof define === 'function') { + define(function(require, exports, module) { + module.exports = inherit; + }); + defineAsGlobal = false; +} - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; +defineAsGlobal && (global.inherit = inherit); - keys = Object.keys(pair); +})(this); - result[index] = [ keys[0], pair[keys[0]] ]; +},{}],24:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor } +} - return result; +},{}],25:[function(require,module,exports){ +/** + * Determine if an object is Buffer + * + * Author: Feross Aboukhadijeh + * License: MIT + * + * `npm install is-buffer` + */ + +module.exports = function (obj) { + return !!(obj != null && + (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + (obj.constructor && + typeof obj.constructor.isBuffer === 'function' && + obj.constructor.isBuffer(obj)) + )) } -module.exports = new Type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); +},{}],26:[function(require,module,exports){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; -},{"../type":36}],49:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ 'use strict'; -var Type = require('../type'); -module.exports = new Type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); +var yaml = require('./lib/js-yaml.js'); -},{"../type":36}],50:[function(require,module,exports){ -'use strict'; -var Type = require('../type'); +module.exports = yaml; -var _hasOwnProperty = Object.prototype.hasOwnProperty; +},{"./lib/js-yaml.js":28}],28:[function(require,module,exports){ +'use strict'; -function resolveYamlSet(data) { - if (data === null) return true; - var key, object = data; +var loader = require('./js-yaml/loader'); +var dumper = require('./js-yaml/dumper'); - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; - } - } - return true; +function deprecated(name) { + return function () { + throw new Error('Function ' + name + ' is deprecated and cannot be used.'); + }; } -function constructYamlSet(data) { - return data !== null ? data : {}; -} -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - -},{"../type":36}],51:[function(require,module,exports){ -'use strict'; +module.exports.Type = require('./js-yaml/type'); +module.exports.Schema = require('./js-yaml/schema'); +module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe'); +module.exports.JSON_SCHEMA = require('./js-yaml/schema/json'); +module.exports.CORE_SCHEMA = require('./js-yaml/schema/core'); +module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); +module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full'); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.safeLoad = loader.safeLoad; +module.exports.safeLoadAll = loader.safeLoadAll; +module.exports.dump = dumper.dump; +module.exports.safeDump = dumper.safeDump; +module.exports.YAMLException = require('./js-yaml/exception'); -var Type = require('../type'); +// Deprecated schema names from JS-YAML 2.0.x +module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe'); +module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); +module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full'); -module.exports = new Type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); +// Deprecated functions from JS-YAML 1.x.x +module.exports.scan = deprecated('scan'); +module.exports.parse = deprecated('parse'); +module.exports.compose = deprecated('compose'); +module.exports.addConstructor = deprecated('addConstructor'); -},{"../type":36}],52:[function(require,module,exports){ +},{"./js-yaml/dumper":30,"./js-yaml/exception":31,"./js-yaml/loader":32,"./js-yaml/schema":34,"./js-yaml/schema/core":35,"./js-yaml/schema/default_full":36,"./js-yaml/schema/default_safe":37,"./js-yaml/schema/failsafe":38,"./js-yaml/schema/json":39,"./js-yaml/type":40}],29:[function(require,module,exports){ 'use strict'; -var Type = require('../type'); -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day +function isNothing(subject) { + return (typeof subject === 'undefined') || (null === subject); +} -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; +function isObject(subject) { + return (typeof subject === 'object') && (null !== subject); } -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); +function toArray(sequence) { + if (Array.isArray(sequence)) { + return sequence; + } else if (isNothing(sequence)) { + return []; + } + return [ sequence ]; +} - if (match === null) throw new Error('Date resolve error'); - // match: [1] year [2] month [3] day +function extend(target, source) { + var index, length, key, sourceKeys; - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); + if (source) { + sourceKeys = Object.keys(source); - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } } - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); + return target; +} - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute +function repeat(string, count) { + var result = '', cycle; - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; + for (cycle = 0; cycle < count; cycle += 1) { + result += string; } - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + return result; +} - if (delta) date.setTime(date.getTime() - delta); - return date; +function isNegativeZero(number) { + return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number); } -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); -} -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; -},{"../type":36}],53:[function(require,module,exports){ -/** ! - * JSON Schema $Ref Parser v3.0.2 - * - * @link https://github.com/BigstickCarpet/json-schema-ref-parser - * @license MIT - */ +},{}],30:[function(require,module,exports){ 'use strict'; -var $Ref = require('./ref'), - Pointer = require('./pointer'), - debug = require('./util/debug'), - url = require('./util/url'); - -module.exports = bundle; - -/** - * Bundles all external JSON references into the main JSON schema, thus resulting in a schema that - * only has *internal* references, not any *external* references. - * This method mutates the JSON schema object, adding new references and re-mapping existing ones. - * - * @param {$RefParser} parser - * @param {$RefParserOptions} options - */ -function bundle(parser, options) { - debug('Bundling $ref pointers in %s', parser.$refs._root$Ref.path); +/*eslint-disable no-use-before-define*/ - // Build an inventory of all $ref pointers in the JSON Schema - var inventory = []; - crawl(parser, 'schema', parser.$refs._root$Ref.path + '#', '#', inventory, parser.$refs, options); +var common = require('./common'); +var YAMLException = require('./exception'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); - // Remap all $ref pointers - remap(inventory); -} +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; -/** - * Recursively crawls the given value, and inventories all JSON references. - * - * @param {object} parent - The object containing the value to crawl. If the value is not an object or array, it will be ignored. - * @param {string} key - The property key of `parent` to be crawled - * @param {string} path - The full path of the property being crawled, possibly with a JSON Pointer in the hash - * @param {string} pathFromRoot - The path of the property being crawled, from the schema root - * @param {object[]} inventory - An array of already-inventoried $ref pointers - * @param {$Refs} $refs - * @param {$RefParserOptions} options - */ -function crawl(parent, key, path, pathFromRoot, inventory, $refs, options) { - var obj = key === null ? parent : parent[key]; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - if (obj && typeof obj === 'object') { - if ($Ref.is$Ref(obj)) { - inventory$Ref(parent, key, path, pathFromRoot, inventory, $refs, options); - } - else { - var keys = Object.keys(obj); +var ESCAPE_SEQUENCES = {}; - // Most people will expect references to be bundled into the the "definitions" property, - // so we always crawl that property first, if it exists. - var defs = keys.indexOf('definitions'); - if (defs > 0) { - keys.splice(0, 0, keys.splice(defs, 1)[0]); - } +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; - keys.forEach(function(key) { - var keyPath = Pointer.join(path, key); - var keyPathFromRoot = Pointer.join(pathFromRoot, key); - var value = obj[key]; +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; - if ($Ref.is$Ref(value)) { - inventory$Ref(obj, key, path, keyPathFromRoot, inventory, $refs, options); - } - else { - crawl(obj, key, keyPath, keyPathFromRoot, inventory, $refs, options); - } - }); - } - } -} +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; -/** - * Inventories the given JSON Reference (i.e. records detailed information about it so we can - * optimize all $refs in the schema), and then crawls the resolved value. - * - * @param {object} $refParent - The object that contains a JSON Reference as one of its keys - * @param {string} $refKey - The key in `$refParent` that is a JSON Reference - * @param {string} path - The full path of the JSON Reference at `$refKey`, possibly with a JSON Pointer in the hash - * @param {string} pathFromRoot - The path of the JSON Reference at `$refKey`, from the schema root - * @param {object[]} inventory - An array of already-inventoried $ref pointers - * @param {$Refs} $refs - * @param {$RefParserOptions} options - */ -function inventory$Ref($refParent, $refKey, path, pathFromRoot, inventory, $refs, options) { - if (inventory.some(function(i) { return i.parent === $refParent && i.key === $refKey; })) { - // This $Ref has already been inventoried, so we don't need to process it again - return; + if (null === map) { + return {}; } - var $ref = $refKey === null ? $refParent : $refParent[$refKey]; - var $refPath = url.resolve(path, $ref.$ref); - var pointer = $refs._resolve($refPath, options); - var depth = Pointer.parse(pathFromRoot).length; - var file = url.stripHash(pointer.path); - var hash = url.getHash(pointer.path); - var external = file !== $refs._root$Ref.path; - var extended = $Ref.isExtended$Ref($ref); - - inventory.push({ - $ref: $ref, // The JSON Reference (e.g. {$ref: string}) - parent: $refParent, // The object that contains this $ref pointer - key: $refKey, // The key in `parent` that is the $ref pointer - pathFromRoot: pathFromRoot, // The path to the $ref pointer, from the JSON Schema root - depth: depth, // How far from the JSON Schema root is this $ref pointer? - file: file, // The file that the $ref pointer resolves to - hash: hash, // The hash within `file` that the $ref pointer resolves to - value: pointer.value, // The resolved value of the $ref pointer - circular: pointer.circular, // Is this $ref pointer DIRECTLY circular? (i.e. it references itself) - extended: extended, // Does this $ref extend its resolved value? (i.e. it has extra properties, in addition to "$ref") - external: external // Does this $ref pointer point to a file other than the main JSON Schema file? - }); + result = {}; + keys = Object.keys(map); - // Recursively crawl the resolved value - crawl(pointer.value, null, pointer.path, pathFromRoot, inventory, $refs, options); -} + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); -/** - * Re-maps every $ref pointer, so that they're all relative to the root of the JSON Schema. - * Each referenced value is dereferenced EXACTLY ONCE. All subsequent references to the same - * value are re-mapped to point to the first reference. - * - * @example: - * { - * first: { $ref: somefile.json#/some/part }, - * second: { $ref: somefile.json#/another/part }, - * third: { $ref: somefile.json }, - * fourth: { $ref: somefile.json#/some/part/sub/part } - * } - * - * In this example, there are four references to the same file, but since the third reference points - * to the ENTIRE file, that's the only one we need to dereference. The other three can just be - * remapped to point inside the third one. - * - * On the other hand, if the third reference DIDN'T exist, then the first and second would both need - * to be dereferenced, since they point to different parts of the file. The fourth reference does NOT - * need to be dereferenced, because it can be remapped to point inside the first one. - * - * @param {object[]} inventory - */ -function remap(inventory) { - // Group & sort all the $ref pointers, so they're in the order that we need to dereference/remap them - inventory.sort(function(a, b) { - if (a.file !== b.file) { - return a.file < b.file ? -1 : +1; // Group all the $refs that point to the same file - } - else if (a.hash !== b.hash) { - return a.hash < b.hash ? -1 : +1; // Group all the $refs that point to the same part of the file - } - else if (a.circular !== b.circular) { - return a.circular ? -1 : +1; // If the $ref points to itself, then sort it higher than other $refs that point to this $ref - } - else if (a.extended !== b.extended) { - return a.extended ? +1 : -1; // If the $ref extends the resolved value, then sort it lower than other $refs that don't extend the value - } - else if (a.depth !== b.depth) { - return a.depth - b.depth; // Sort $refs by how close they are to the JSON Schema root - } - else { - // If all else is equal, use the $ref that's in the "definitions" property - return b.pathFromRoot.lastIndexOf('/definitions') - a.pathFromRoot.lastIndexOf('/definitions'); + if ('!!' === tag.slice(0, 2)) { + tag = 'tag:yaml.org,2002:' + tag.slice(2); } - }); - var file, hash, pathFromRoot; - inventory.forEach(function(i) { - debug('Re-mapping $ref pointer "%s" at %s', i.$ref.$ref, i.pathFromRoot); + type = schema.compiledTypeMap[tag]; - if (!i.external) { - // This $ref already resolves to the main JSON Schema file - i.$ref.$ref = i.hash; - } - else if (i.file === file && i.hash === hash) { - // This $ref points to the same value as the prevous $ref, so remap it to the same path - i.$ref.$ref = pathFromRoot; - } - else if (i.file === file && i.hash.indexOf(hash + '/') === 0) { - // This $ref points to the a sub-value as the prevous $ref, so remap it beneath that path - i.$ref.$ref = Pointer.join(pathFromRoot, Pointer.parse(i.hash)); - } - else { - // We've moved to a new file or new hash - file = i.file; - hash = i.hash; - pathFromRoot = i.pathFromRoot; - - // This is the first $ref to point to this value, so dereference the value. - // Any other $refs that point to the same value will point to this $ref instead - i.$ref = i.parent[i.key] = $Ref.dereference(i.$ref, i.value); - - if (i.circular) { - // This $ref points to itself - i.$ref.$ref = i.pathFromRoot; - } + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; } - debug(' new value: %s', (i.$ref && i.$ref.$ref) ? i.$ref.$ref : '[object Object]'); - }); -} + result[tag] = style; + } -},{"./pointer":62,"./ref":63,"./util/debug":68,"./util/url":71}],54:[function(require,module,exports){ -'use strict'; + return result; +} -var $Ref = require('./ref'), - Pointer = require('./pointer'), - ono = require('ono'), - debug = require('./util/debug'), - url = require('./util/url'); +function encodeHex(character) { + var string, handle, length; -module.exports = dereference; + string = character.toString(16).toUpperCase(); -/** - * Crawls the JSON schema, finds all JSON references, and dereferences them. - * This method mutates the JSON schema object, replacing JSON references with their resolved value. - * - * @param {$RefParser} parser - * @param {$RefParserOptions} options - */ -function dereference(parser, options) { - debug('Dereferencing $ref pointers in %s', parser.$refs._root$Ref.path); - var dereferenced = crawl(parser.schema, parser.$refs._root$Ref.path, '#', [], parser.$refs, options); - parser.$refs.circular = dereferenced.circular; - parser.schema = dereferenced.value; + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; } -/** - * Recursively crawls the given value, and dereferences any JSON references. - * - * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. - * @param {string} path - The full path of `obj`, possibly with a JSON Pointer in the hash - * @param {string} pathFromRoot - The path of `obj` from the schema root - * @param {object[]} parents - An array of the parent objects that have already been dereferenced - * @param {$Refs} $refs - * @param {$RefParserOptions} options - * @returns {{value: object, circular: boolean}} - */ -function crawl(obj, path, pathFromRoot, parents, $refs, options) { - var dereferenced; - var result = { - value: obj, - circular: false - }; +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; - if (obj && typeof obj === 'object') { - parents.push(obj); + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; - if ($Ref.isAllowed$Ref(obj, options)) { - dereferenced = dereference$Ref(obj, path, pathFromRoot, parents, $refs, options); - result.circular = dereferenced.circular; - result.value = dereferenced.value; - } - else { - Object.keys(obj).forEach(function(key) { - var keyPath = Pointer.join(path, key); - var keyPathFromRoot = Pointer.join(pathFromRoot, key); - var value = obj[key]; - var circular = false; + this.tag = null; + this.result = ''; - if ($Ref.isAllowed$Ref(value, options)) { - dereferenced = dereference$Ref(value, keyPath, keyPathFromRoot, parents, $refs, options); - circular = dereferenced.circular; - obj[key] = dereferenced.value; - } - else { - if (parents.indexOf(value) === -1) { - dereferenced = crawl(value, keyPath, keyPathFromRoot, parents, $refs, options); - circular = dereferenced.circular; - obj[key] = dereferenced.value; - } - else { - circular = foundCircularReference(keyPath, $refs, options); - } - } + this.duplicates = []; + this.usedDuplicates = null; +} - // Set the "isCircular" flag if this or any other property is circular - result.circular = result.circular || circular; - }); - } +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; - parents.pop(); + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + if (line.length && line !== '\n') { + result += ind; + } + result += line; } return result; } -/** - * Dereferences the given JSON Reference, and then crawls the resulting value. - * - * @param {{$ref: string}} $ref - The JSON Reference to resolve - * @param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash - * @param {string} pathFromRoot - The path of `$ref` from the schema root - * @param {object[]} parents - An array of the parent objects that have already been dereferenced - * @param {$Refs} $refs - * @param {$RefParserOptions} options - * @returns {{value: object, circular: boolean}} - */ -function dereference$Ref($ref, path, pathFromRoot, parents, $refs, options) { - debug('Dereferencing $ref pointer "%s" at %s', $ref.$ref, path); - - var $refPath = url.resolve(path, $ref.$ref); - var pointer = $refs._resolve($refPath, options); - - // Check for circular references - var directCircular = pointer.circular; - var circular = directCircular || parents.indexOf(pointer.value) !== -1; - circular && foundCircularReference(path, $refs, options); - - // Dereference the JSON reference - var dereferencedValue = $Ref.dereference($ref, pointer.value); +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} - // Crawl the dereferenced value (unless it's circular) - if (!circular) { - // Determine if the dereferenced value is circular - var dereferenced = crawl(dereferencedValue, pointer.path, pathFromRoot, parents, $refs, options); - circular = dereferenced.circular; - dereferencedValue = dereferenced.value; - } +function testImplicitResolving(state, str) { + var index, length, type; - if (circular && !directCircular && options.dereference.circular === 'ignore') { - // The user has chosen to "ignore" circular references, so don't change the value - dereferencedValue = $ref; - } + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; - if (directCircular) { - // The pointer is a DIRECT circular reference (i.e. it references itself). - // So replace the $ref path with the absolute path from the JSON Schema root - dereferencedValue.$ref = pathFromRoot; + if (type.resolve(str)) { + return true; + } } - return { - circular: circular, - value: dereferencedValue - }; + return false; } -/** - * Called when a circular reference is found. - * It sets the {@link $Refs#circular} flag, and throws an error if options.dereference.circular is false. - * - * @param {string} keyPath - The JSON Reference path of the circular reference - * @param {$Refs} $refs - * @param {$RefParserOptions} options - * @returns {boolean} - always returns true, to indicate that a circular reference was found - */ -function foundCircularReference(keyPath, $refs, options) { - $refs.circular = true; - if (!options.dereference.circular) { - throw ono.reference('Circular $ref pointer found at %s', keyPath); - } - return true; +function StringBuilder(source) { + this.source = source; + this.result = ''; + this.checkpoint = 0; } -},{"./pointer":62,"./ref":63,"./util/debug":68,"./util/url":71,"ono":76}],55:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +StringBuilder.prototype.takeUpTo = function (position) { + var er; -var Promise = require('./util/promise'), - Options = require('./options'), - $Refs = require('./refs'), - parse = require('./parse'), - resolve = require('./resolve'), - bundle = require('./bundle'), - dereference = require('./dereference'), - url = require('./util/url'), - maybe = require('call-me-maybe'), - ono = require('ono'); + if (position < this.checkpoint) { + er = new Error('position should be > checkpoint'); + er.position = position; + er.checkpoint = this.checkpoint; + throw er; + } -module.exports = $RefParser; -module.exports.YAML = require('./util/yaml'); + this.result += this.source.slice(this.checkpoint, position); + this.checkpoint = position; + return this; +}; -/** - * This class parses a JSON schema, builds a map of its JSON references and their resolved values, - * and provides methods for traversing, manipulating, and dereferencing those references. - * - * @constructor - */ -function $RefParser() { - /** - * The parsed (and possibly dereferenced) JSON schema object - * - * @type {object} - * @readonly - */ - this.schema = null; +StringBuilder.prototype.escapeChar = function () { + var character, esc; - /** - * The resolved JSON references - * - * @type {$Refs} - * @readonly - */ - this.$refs = new $Refs(); -} + character = this.source.charCodeAt(this.checkpoint); + esc = ESCAPE_SEQUENCES[character] || encodeHex(character); + this.result += esc; + this.checkpoint += 1; -/** - * Parses the given JSON schema. - * This method does not resolve any JSON references. - * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed - * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object. - * @returns {Promise} - The returned promise resolves with the parsed JSON schema object. - */ -$RefParser.parse = function(schema, options, callback) { - var Class = this; // eslint-disable-line consistent-this - return new Class().parse(schema, options, callback); + return this; }; -/** - * Parses the given JSON schema. - * This method does not resolve any JSON references. - * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed - * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object. - * @returns {Promise} - The returned promise resolves with the parsed JSON schema object. - */ -$RefParser.prototype.parse = function(schema, options, callback) { - var args = normalizeArgs(arguments); - var promise; +StringBuilder.prototype.finish = function () { + if (this.source.length > this.checkpoint) { + this.takeUpTo(this.source.length); + } +}; - if (!args.schema || (typeof args.schema !== 'string' && typeof args.schema !== 'object')) { - var err = ono('Expected a file path, URL, or object. Got %s', args.schema); - return maybe(args.callback, Promise.reject(err)); +function writeScalar(state, object, level, iskey) { + var simple, first, spaceWrap, folded, literal, single, double, + sawLineFeed, linePosition, longestLine, indent, max, character, + position, escapeSeq, hexEsc, previous, lineLength, modifier, + trailingLineBreaks, result; + + if (0 === object.length) { + state.dump = "''"; + return; } - // Reset everything - this.schema = null; - this.$refs = new $Refs(); + if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) { + state.dump = "'" + object + "'"; + return; + } + + simple = true; + first = object.length ? object.charCodeAt(0) : 0; + spaceWrap = (CHAR_SPACE === first || + CHAR_SPACE === object.charCodeAt(object.length - 1)); - if (typeof args.schema === 'object') { - // The schema is an object, not a path/url. - // So immediately add a new $Ref with the schema object as its value - this.$refs._add('', args.schema); - promise = Promise.resolve(args.schema); + // Simplified check for restricted first characters + // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29 + if (CHAR_MINUS === first || + CHAR_QUESTION === first || + CHAR_COMMERCIAL_AT === first || + CHAR_GRAVE_ACCENT === first) { + simple = false; } - else { - // The schema is a path/url - var path = args.schema; - // If it's a filesystem path, then convert it to a URL. - // NOTE: According to the JSON Reference spec, these should already be URLs, - // but, in practice, many people use local filesystem paths instead. - // So we're being generous here and doing the conversion automatically. - // This is not intended to be a 100% bulletproof solution. - // If it doesn't work for your use-case, then use a URL instead. - if (url.isFileSystemPath(path)) { - path = url.fromFileSystemPath(path); - } + // can only use > and | if not wrapped in spaces or is not a key. + if (spaceWrap) { + simple = false; + folded = false; + literal = false; + } else { + folded = !iskey; + literal = !iskey; + } - // Resolve the absolute path of the schema - path = url.resolve(url.cwd(), path); + single = true; + double = new StringBuilder(object); + + sawLineFeed = false; + linePosition = 0; + longestLine = 0; + + indent = state.indent * level; + max = state.lineWidth; + if (max === -1) { + // Replace -1 with biggest ingeger number according to + // http://ecma262-5.com/ELS5_HTML.htm#Section_8.5 + max = 9007199254740991; + } - // Parse the schema file/url - promise = parse(path, this.$refs, args.options); + if (indent < 40) { + max -= indent; + } else { + max = 40; } - var me = this; - return promise - .then(function(result) { - if (!result || typeof result !== 'object' || Buffer.isBuffer(result)) { - throw ono.syntax('"%s" is not a valid JSON Schema', me.$refs._root$Ref.path || result); - } - else { - me.schema = result; - return maybe(args.callback, Promise.resolve(me.schema)); + for (position = 0; position < object.length; position++) { + character = object.charCodeAt(position); + if (simple) { + // Characters that can never appear in the simple scalar + if (!simpleChar(character)) { + simple = false; + } else { + // Still simple. If we make it all the way through like + // this, then we can just dump the string as-is. + continue; } - }) - .catch(function(e) { - return maybe(args.callback, Promise.reject(e)); - }); -}; + } -/** - * Parses the given JSON schema and resolves any JSON references, including references in - * externally-referenced files. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved - * @param {function} [callback] - * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references - * - * @returns {Promise} - * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references - */ -$RefParser.resolve = function(schema, options, callback) { - var Class = this; // eslint-disable-line consistent-this - return new Class().resolve(schema, options, callback); -}; + if (single && character === CHAR_SINGLE_QUOTE) { + single = false; + } -/** - * Parses the given JSON schema and resolves any JSON references, including references in - * externally-referenced files. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved - * @param {function} [callback] - * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references - * - * @returns {Promise} - * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references - */ -$RefParser.prototype.resolve = function(schema, options, callback) { - var me = this; - var args = normalizeArgs(arguments); + escapeSeq = ESCAPE_SEQUENCES[character]; + hexEsc = needsHexEscape(character); - return this.parse(args.schema, args.options) - .then(function() { - return resolve(me, args.options); - }) - .then(function() { - return maybe(args.callback, Promise.resolve(me.$refs)); - }) - .catch(function(err) { - return maybe(args.callback, Promise.reject(err)); - }); -}; + if (!escapeSeq && !hexEsc) { + continue; + } -/** - * Parses the given JSON schema, resolves any JSON references, and bundles all external references - * into the main JSON schema. This produces a JSON schema that only has *internal* references, - * not any *external* references. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced - * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object - * @returns {Promise} - The returned promise resolves with the bundled JSON schema object. - */ -$RefParser.bundle = function(schema, options, callback) { - var Class = this; // eslint-disable-line consistent-this - return new Class().bundle(schema, options, callback); -}; + if (character !== CHAR_LINE_FEED && + character !== CHAR_DOUBLE_QUOTE && + character !== CHAR_SINGLE_QUOTE) { + folded = false; + literal = false; + } else if (character === CHAR_LINE_FEED) { + sawLineFeed = true; + single = false; + if (position > 0) { + previous = object.charCodeAt(position - 1); + if (previous === CHAR_SPACE) { + literal = false; + folded = false; + } + } + if (folded) { + lineLength = position - linePosition; + linePosition = position; + if (lineLength > longestLine) { + longestLine = lineLength; + } + } + } -/** - * Parses the given JSON schema, resolves any JSON references, and bundles all external references - * into the main JSON schema. This produces a JSON schema that only has *internal* references, - * not any *external* references. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced - * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object - * @returns {Promise} - The returned promise resolves with the bundled JSON schema object. - */ -$RefParser.prototype.bundle = function(schema, options, callback) { - var me = this; - var args = normalizeArgs(arguments); + if (character !== CHAR_DOUBLE_QUOTE) { + single = false; + } - return this.resolve(args.schema, args.options) - .then(function() { - bundle(me, args.options); - return maybe(args.callback, Promise.resolve(me.schema)); - }) - .catch(function(err) { - return maybe(args.callback, Promise.reject(err)); - }); -}; + double.takeUpTo(position); + double.escapeChar(); + } -/** - * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema. - * That is, all JSON references are replaced with their resolved values. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced - * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object - * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object. - */ -$RefParser.dereference = function(schema, options, callback) { - var Class = this; // eslint-disable-line consistent-this - return new Class().dereference(schema, options, callback); -}; + if (simple && testImplicitResolving(state, object)) { + simple = false; + } -/** - * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema. - * That is, all JSON references are replaced with their resolved values. - * - * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. - * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced - * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object - * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object. - */ -$RefParser.prototype.dereference = function(schema, options, callback) { - var me = this; - var args = normalizeArgs(arguments); + modifier = ''; + if (folded || literal) { + trailingLineBreaks = 0; + if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) { + trailingLineBreaks += 1; + if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) { + trailingLineBreaks += 1; + } + } - return this.resolve(args.schema, args.options) - .then(function() { - dereference(me, args.options); - return maybe(args.callback, Promise.resolve(me.schema)); - }) - .catch(function(err) { - return maybe(args.callback, Promise.reject(err)); - }); -}; + if (trailingLineBreaks === 0) { + modifier = '-'; + } else if (trailingLineBreaks === 2) { + modifier = '+'; + } + } -/** - * Normalizes the given arguments, accounting for optional args. - * - * @param {Arguments} args - * @returns {object} - */ -function normalizeArgs(args) { - var options = args[1], callback = args[2]; - if (typeof options === 'function') { - callback = options; - options = undefined; + if (literal && longestLine < max) { + folded = false; } - if (!(options instanceof Options)) { - options = new Options(options); + + // If it's literally one line, then don't bother with the literal. + // We may still want to do a fold, though, if it's a super long line. + if (!sawLineFeed) { + literal = false; } - return { - schema: args[0], - options: options, - callback: callback - }; -} -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) + if (simple) { + state.dump = object; + } else if (single) { + state.dump = '\'' + object + '\''; + } else if (folded) { + result = fold(object, max); + state.dump = '>' + modifier + '\n' + indentString(result, indent); + } else if (literal) { + if (!modifier) { + object = object.replace(/\n$/, ''); + } + state.dump = '|' + modifier + '\n' + indentString(object, indent); + } else if (double) { + double.finish(); + state.dump = '"' + double.result + '"'; + } else { + throw new Error('Failed to dump scalar value'); + } -},{"../../is-buffer/index.js":21,"./bundle":53,"./dereference":54,"./options":56,"./parse":57,"./refs":64,"./resolve":65,"./util/promise":70,"./util/url":71,"./util/yaml":72,"call-me-maybe":12,"ono":76}],56:[function(require,module,exports){ -/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ -'use strict'; + return; +} -var jsonParser = require('./parsers/json'), - yamlParser = require('./parsers/yaml'), - textParser = require('./parsers/text'), - binaryParser = require('./parsers/binary'), - fileResolver = require('./resolvers/file'), - httpResolver = require('./resolvers/http'); +// The `trailing` var is a regexp match of any trailing `\n` characters. +// +// There are three cases we care about: +// +// 1. One trailing `\n` on the string. Just use `|` or `>`. +// This is the assumed default. (trailing = null) +// 2. No trailing `\n` on the string. Use `|-` or `>-` to "chomp" the end. +// 3. More than one trailing `\n` on the string. Use `|+` or `>+`. +// +// In the case of `>+`, these line breaks are *not* doubled (like the line +// breaks within the string), so it's important to only end with the exact +// same number as we started. +function fold(object, max) { + var result = '', + position = 0, + length = object.length, + trailing = /\n+$/.exec(object), + newLine; -module.exports = $RefParserOptions; + if (trailing) { + length = trailing.index + 1; + } -/** - * Options that determine how JSON schemas are parsed, resolved, and dereferenced. - * - * @param {object|$RefParserOptions} [options] - Overridden options - * @constructor - */ -function $RefParserOptions(options) { - merge(this, $RefParserOptions.defaults); - merge(this, options); + while (position < length) { + newLine = object.indexOf('\n', position); + if (newLine > length || newLine === -1) { + if (result) { + result += '\n\n'; + } + result += foldLine(object.slice(position, length), max); + position = length; + } else { + if (result) { + result += '\n\n'; + } + result += foldLine(object.slice(position, newLine), max); + position = newLine + 1; + } + } + if (trailing && trailing[0] !== '\n') { + result += trailing[0]; + } + + return result; } -$RefParserOptions.defaults = { - /** - * Determines how different types of files will be parsed. - * - * You can add additional parsers of your own, replace an existing one with - * your own implemenation, or disable any parser by setting it to false. - * - * Each of the built-in parsers has the following options: - * - * order {number} - The order in which the parsers will run - * - * ext {string[]} - An array of file extensions and/or RegExp patterns. - * Only matching files will be parsed by this parser. - * - * empty {boolean} - Whether to allow "empty" files. Enabled by default. - * "Empty" includes zero-byte files, as well as JSON/YAML files that - * don't contain any keys. - */ - parse: { - json: jsonParser, - yaml: yamlParser, - text: textParser, - binary: binaryParser, - }, +function foldLine(line, max) { + if (line === '') { + return line; + } - /** - * Determines how JSON References will be resolved. - * - * You can add additional resolvers of your own, replace an existing one with - * your own implemenation, or disable any resolver by setting it to false. - * - * Each of the built-in resolvers has the following options: - * - * order {number} - The order in which the resolver will run - * - * The HTTP resolver has additional options. See read/http.js for details. - */ - resolve: { - file: fileResolver, - http: httpResolver, - - /** - * Determines whether external $ref pointers will be resolved. - * If this option is disabled, then none of above resolvers will be called. - * Instead, external $ref pointers will simply be ignored. - * - * @type {boolean} - */ - external: true, - }, - - /** - * Determines the types of JSON references that are allowed. - */ - dereference: { - /** - * Dereference circular (recursive) JSON references? - * If false, then a {@link ReferenceError} will be thrown if a circular reference is found. - * If "ignore", then circular references will not be dereferenced. - * - * @type {boolean|string} - */ - circular: true - }, -}; + var foldRe = /[^\s] [^\s]/g, + result = '', + prevMatch = 0, + foldStart = 0, + match = foldRe.exec(line), + index, + foldEnd, + folded; -/** - * Merges the properties of the source object into the target object. - * - * @param {object} target - The object that we're populating - * @param {?object} source - The options that are being merged - * @returns {object} - */ -function merge(target, source) { - if (isMergeable(source)) { - var keys = Object.keys(source); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var sourceSetting = source[key]; - var targetSetting = target[key]; + while (match) { + index = match.index; - if (isMergeable(sourceSetting)) { - // It's a nested object, so merge it recursively - target[key] = merge(targetSetting || {}, sourceSetting); + // when we cross the max len, if the previous match would've + // been ok, use that one, and carry on. If there was no previous + // match on this fold section, then just have a long line. + if (index - foldStart > max) { + if (prevMatch !== foldStart) { + foldEnd = prevMatch; + } else { + foldEnd = index; } - else if (sourceSetting !== undefined) { - // It's a scalar value, function, or array. No merging necessary. Just overwrite the target value. - target[key] = sourceSetting; + + if (result) { + result += '\n'; } + folded = line.slice(foldStart, foldEnd); + result += folded; + foldStart = foldEnd + 1; } + prevMatch = index + 1; + match = foldRe.exec(line); } - return target; -} - -/** - * Determines whether the given value can be merged, - * or if it is a scalar value that should just override the target value. - * - * @param {*} val - * @returns {Boolean} - */ -function isMergeable(val) { - return val && - (typeof val === 'object') && - !Array.isArray(val) && - !(val instanceof RegExp) && - !(val instanceof Date); -} - -},{"./parsers/binary":58,"./parsers/json":59,"./parsers/text":60,"./parsers/yaml":61,"./resolvers/file":66,"./resolvers/http":67}],57:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var ono = require('ono'), - debug = require('./util/debug'), - url = require('./util/url'), - plugins = require('./util/plugins'), - Promise = require('./util/promise'); -module.exports = parse; + if (result) { + result += '\n'; + } -/** - * Reads and parses the specified file path or URL. - * - * @param {string} path - This path MUST already be resolved, since `read` doesn't know the resolution context - * @param {$Refs} $refs - * @param {$RefParserOptions} options - * - * @returns {Promise} - * The promise resolves with the parsed file contents, NOT the raw (Buffer) contents. - */ -function parse(path, $refs, options) { - try { - // Remove the URL fragment, if any - path = url.stripHash(path); + // if we end up with one last word at the end, then the last bit might + // be slightly bigger than we wanted, because we exited out of the loop. + if (foldStart !== prevMatch && line.length - foldStart > max) { + result += line.slice(foldStart, prevMatch) + '\n' + + line.slice(prevMatch + 1); + } else { + result += line.slice(foldStart); + } - // Add a new $Ref for this file, even though we don't have the value yet. - // This ensures that we don't simultaneously read & parse the same file multiple times - var $ref = $refs._add(path); + return result; +} - // This "file object" will be passed to all resolvers and parsers. - var file = { - url: path, - extension: url.getExtension(path), - }; +// Returns true if character can be found in a simple scalar +function simpleChar(character) { + return CHAR_TAB !== character && + CHAR_LINE_FEED !== character && + CHAR_CARRIAGE_RETURN !== character && + CHAR_COMMA !== character && + CHAR_LEFT_SQUARE_BRACKET !== character && + CHAR_RIGHT_SQUARE_BRACKET !== character && + CHAR_LEFT_CURLY_BRACKET !== character && + CHAR_RIGHT_CURLY_BRACKET !== character && + CHAR_SHARP !== character && + CHAR_AMPERSAND !== character && + CHAR_ASTERISK !== character && + CHAR_EXCLAMATION !== character && + CHAR_VERTICAL_LINE !== character && + CHAR_GREATER_THAN !== character && + CHAR_SINGLE_QUOTE !== character && + CHAR_DOUBLE_QUOTE !== character && + CHAR_PERCENT !== character && + CHAR_COLON !== character && + !ESCAPE_SEQUENCES[character] && + !needsHexEscape(character); +} - // Read the file and then parse the data - return readFile(file, options) - .then(function(resolver) { - $ref.pathType = resolver.plugin.name; - file.data = resolver.result; - return parseFile(file, options); - }) - .then(function(parser) { - $ref.value = parser.result; - return parser.result; - }); - } - catch (e) { - return Promise.reject(e); - } +// Returns true if the character code needs to be escaped. +function needsHexEscape(character) { + return !((0x00020 <= character && character <= 0x00007E) || + (0x00085 === character) || + (0x000A0 <= character && character <= 0x00D7FF) || + (0x0E000 <= character && character <= 0x00FFFD) || + (0x10000 <= character && character <= 0x10FFFF)); } -/** - * Reads the given file, using the configured resolver plugins - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {$RefParserOptions} options - * - * @returns {Promise} - * The promise resolves with the raw file contents and the resolver that was used. - */ -function readFile(file, options) { - return new Promise(function(resolve, reject) { - debug('Reading %s', file.url); - - // Find the resolvers that can read this file - var resolvers = plugins.all(options.resolve); - resolvers = plugins.filter(resolvers, 'canRead', file); - - // Run the resolvers, in order, until one of them succeeds - plugins.sort(resolvers); - plugins.run(resolvers, 'read', file) - .then(resolve, onError); - - function onError(err) { - // Throw the original error, if it's one of our own (user-friendly) errors. - // Otherwise, throw a generic, friendly error. - if (err && !(err instanceof SyntaxError)) { - reject(err); - } - else { - reject(ono.syntax('Unable to resolve $ref pointer "%s"', file.url)); +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (0 !== index) { + _result += ', '; } + _result += state.dump; } - }); + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; } -/** - * Parses the given file's contents, using the configured parser plugins. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @param {$RefParserOptions} options - * - * @returns {Promise} - * The promise resolves with the parsed file contents and the parser that was used. - */ -function parseFile(file, options) { - return new Promise(function(resolve, reject) { - debug('Parsing %s', file.url); - - // Find the parsers that can read this file type. - // If none of the parsers are an exact match for this file, then we'll try ALL of them. - // This handles situations where the file IS a supported type, just with an unknown extension. - var allParsers = plugins.all(options.parse); - var filteredParsers = plugins.filter(allParsers, 'canParse', file); - var parsers = filteredParsers.length > 0 ? filteredParsers : allParsers; - - // Run the parsers, in order, until one of them succeeds - plugins.sort(parsers); - plugins.run(parsers, 'parse', file) - .then(onParsed, onError); - - function onParsed(parser) { - if (!parser.plugin.allowEmpty && isEmpty(parser.result)) { - reject(ono.syntax('Error parsing "%s" as %s. \nParsed value is empty', file.url, parser.plugin.name)); - } - else { - resolve(parser); - } - } +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; - function onError(err) { - if (err) { - err = err instanceof Error ? err : new Error(err); - reject(ono.syntax(err, 'Error parsing %s', file.url)); - } - else { - reject(ono.syntax('Unable to parse %s', file.url)); + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || 0 !== index) { + _result += generateNextLine(state, level); } + _result += '- ' + state.dump; } - }); -} + } -/** - * Determines whether the parsed value is "empty". - * - * @param {*} value - * @returns {boolean} - */ -function isEmpty(value) { - return value === undefined || - (typeof value === 'object' && Object.keys(value).length === 0) || - (typeof value === 'string' && value.trim().length === 0) || - (Buffer.isBuffer(value) && value.length === 0); + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. } -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) - -},{"../../is-buffer/index.js":21,"./util/debug":68,"./util/plugins":69,"./util/promise":70,"./util/url":71,"ono":76}],58:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i; +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; -module.exports = { - /** - * The order that this parser will run, in relation to other parsers. - * - * @type {number} - */ - order: 400, + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; - /** - * Whether to allow "empty" files (zero bytes). - * - * @type {boolean} - */ - allowEmpty: true, + if (0 !== index) { + pairBuffer += ', '; + } - /** - * Determines whether this parser can parse a given file reference. - * Parsers that return true will be tried, in order, until one successfully parses the file. - * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case - * every parser will be tried. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {boolean} - */ - canParse: function isBinary(file) { - // Use this parser if the file is a Buffer, and has a known binary extension - return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url); - }, + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; - /** - * Parses the given data as a Buffer (byte array). - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {Promise} - */ - parse: function parseBinary(file) { - if (Buffer.isBuffer(file.data)) { - return file.data; - } - else { - // This will reject if data is anything other than a string or typed array - return new Buffer(file.data); + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; } - } -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":10}],59:[function(require,module,exports){ -(function (Buffer){ -'use strict'; + if (state.dump.length > 1024) { + pairBuffer += '? '; + } -var Promise = require('../util/promise'); + pairBuffer += state.dump + ': '; -module.exports = { - /** - * The order that this parser will run, in relation to other parsers. - * - * @type {number} - */ - order: 100, + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } - /** - * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects. - * - * @type {boolean} - */ - allowEmpty: true, + pairBuffer += state.dump; - /** - * Determines whether this parser can parse a given file reference. - * Parsers that match will be tried, in order, until one successfully parses the file. - * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case - * every parser will be tried. - * - * @type {RegExp|string[]|function} - */ - canParse: '.json', + // Both key and value are valid. + _result += pairBuffer; + } - /** - * Parses the given file as JSON - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {Promise} - */ - parse: function parseJSON(file) { - return new Promise(function(resolve, reject) { - var data = file.data; - if (Buffer.isBuffer(data)) { - data = data.toString(); - } + state.tag = _tag; + state.dump = '{' + _result + '}'; +} - if (typeof data === 'string') { - if (data.trim().length === 0) { - resolve(undefined); // This mirrors the YAML behavior - } - else { - resolve(JSON.parse(data)); - } - } - else { - // data is already a JavaScript value (object, array, number, null, NaN, etc.) - resolve(data); - } - }); +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); } -}; -}).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; -},{"../../../is-buffer/index.js":21,"../util/promise":70}],60:[function(require,module,exports){ -(function (Buffer){ -'use strict'; + if (!compact || 0 !== index) { + pairBuffer += generateNextLine(state, level); + } -var TEXT_REGEXP = /\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i; + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; -module.exports = { - /** - * The order that this parser will run, in relation to other parsers. - * - * @type {number} - */ - order: 300, + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } - /** - * Whether to allow "empty" files (zero bytes). - * - * @type {boolean} - */ - allowEmpty: true, + explicitPair = (null !== state.tag && '?' !== state.tag) || + (state.dump && state.dump.length > 1024); - /** - * The encoding that the text is expected to be in. - * - * @type {string} - */ - encoding: 'utf8', + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } - /** - * Determines whether this parser can parse a given file reference. - * Parsers that return true will be tried, in order, until one successfully parses the file. - * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case - * every parser will be tried. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {boolean} - */ - canParse: function isText(file) { - // Use this parser if the file is a string or Buffer, and has a known text-based extension - return (typeof file.data === 'string' || Buffer.isBuffer(file.data)) && TEXT_REGEXP.test(file.url); - }, + pairBuffer += state.dump; - /** - * Parses the given file as text - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {Promise} - */ - parse: function parseText(file) { - if (typeof file.data === 'string') { - return file.data; + if (explicitPair) { + pairBuffer += generateNextLine(state, level); } - else if (Buffer.isBuffer(file.data)) { - return file.data.toString(this.encoding); + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. } - else { - throw new Error('data is not text'); + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; } -}; -}).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} -},{"../../../is-buffer/index.js":21}],61:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; -var Promise = require('../util/promise'), - YAML = require('../util/yaml'); + typeList = explicit ? state.explicitTypes : state.implicitTypes; -module.exports = { - /** - * The order that this parser will run, in relation to other parsers. - * - * @type {number} - */ - order: 200, + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; - /** - * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects. - * - * @type {boolean} - */ - allowEmpty: true, + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { - /** - * Determines whether this parser can parse a given file reference. - * Parsers that match will be tried, in order, until one successfully parses the file. - * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case - * every parser will be tried. - * - * @type {RegExp|string[]|function} - */ - canParse: ['.yaml', '.yml', '.json'], // JSON is valid YAML + state.tag = explicit ? type.tag : '?'; - /** - * Parses the given file as YAML - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {Promise} - */ - parse: function parseYAML(file) { - return new Promise(function(resolve, reject) { - var data = file.data; - if (Buffer.isBuffer(data)) { - data = data.toString(); - } + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; - if (typeof data === 'string') { - resolve(YAML.parse(data)); - } - else { - // data is already a JavaScript value (object, array, number, null, NaN, etc.) - resolve(data); + if ('[object Function]' === _toString.call(type.represent)) { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; } - }); - } -}; -}).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) + return true; + } + } -},{"../../../is-buffer/index.js":21,"../util/promise":70,"../util/yaml":72}],62:[function(require,module,exports){ -'use strict'; + return false; +} -module.exports = Pointer; +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; -var $Ref = require('./ref'), - url = require('./util/url'), - ono = require('ono'), - slashes = /\//g, - tildes = /~/g, - escapedSlash = /~1/g, - escapedTilde = /~0/g; + if (!detectType(state, object, false)) { + detectType(state, object, true); + } -/** - * This class represents a single JSON pointer and its resolved value. - * - * @param {$Ref} $ref - * @param {string} path - * @constructor - */ -function Pointer($ref, path) { - /** - * The {@link $Ref} object that contains this {@link Pointer} object. - * @type {$Ref} - */ - this.$ref = $ref; + var type = _toString.call(state.dump); - /** - * The file path or URL, containing the JSON pointer in the hash. - * This path is relative to the path of the main JSON schema file. - * @type {string} - */ - this.path = path; + if (block) { + block = (0 > state.flowLevel || state.flowLevel > level); + } - /** - * The value of the JSON pointer. - * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays). - * @type {?*} - */ - this.value = undefined; + var objectOrArray = '[object Object]' === type || '[object Array]' === type, + duplicateIndex, + duplicate; - /** - * Indicates whether the pointer references itself. - * @type {boolean} - */ - this.circular = false; -} + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } -/** - * Resolves the value of a nested property within the given object. - * - * @param {*} obj - The object that will be crawled - * @param {$RefParserOptions} options - * - * @returns {Pointer} - * Returns a JSON pointer whose {@link Pointer#value} is the resolved value. - * If resolving this value required resolving other JSON references, then - * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path - * of the resolved value. - */ -Pointer.prototype.resolve = function(obj, options) { - var tokens = Pointer.parse(this.path); + if ((null !== state.tag && '?' !== state.tag) || duplicate || (2 !== state.indent && level > 0)) { + compact = false; + } - // Crawl the object, one token at a time - this.value = obj; - for (var i = 0; i < tokens.length; i++) { - if (resolveIf$Ref(this, options)) { - // The $ref path has changed, so append the remaining tokens to the path - this.path = Pointer.join(this.path, tokens.slice(i)); + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; } - - var token = tokens[i]; - if (this.value[token] === undefined) { - throw ono.syntax('Error resolving $ref pointer "%s". \nToken "%s" does not exist.', this.path, token); + if ('[object Object]' === type) { + if (block && (0 !== Object.keys(state.dump).length)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if ('[object Array]' === type) { + if (block && (0 !== state.dump.length)) { + writeBlockSequence(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if ('[object String]' === type) { + if ('?' !== state.tag) { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) { + return false; + } + throw new YAMLException('unacceptable kind of an object to dump ' + type); } - else { - this.value = this.value[token]; + + if (null !== state.tag && '?' !== state.tag) { + state.dump = '!<' + state.tag + '> ' + state.dump; } } - // Resolve the final value - resolveIf$Ref(this, options); - return this; -}; + return true; +} -/** - * Sets the value of a nested property within the given object. - * - * @param {*} obj - The object that will be crawled - * @param {*} value - the value to assign - * @param {$RefParserOptions} options - * - * @returns {*} - * Returns the modified object, or an entirely new object if the entire object is overwritten. - */ -Pointer.prototype.set = function(obj, value, options) { - var tokens = Pointer.parse(this.path); - var token; +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; - if (tokens.length === 0) { - // There are no tokens, replace the entire object with the new value - this.value = value; - return value; + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); } + state.usedDuplicates = new Array(length); +} - // Crawl the object, one token at a time - this.value = obj; - for (var i = 0; i < tokens.length - 1; i++) { - resolveIf$Ref(this, options); +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; - token = tokens[i]; - if (this.value && this.value[token] !== undefined) { - // The token exists - this.value = this.value[token]; - } - else { - // The token doesn't exist, so create it - this.value = setValue(this, token, {}); + if (null !== object && 'object' === typeof object) { + index = objects.indexOf(object); + if (-1 !== index) { + if (-1 === duplicatesIndexes.indexOf(index)) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } } } +} - // Set the value of the final token - resolveIf$Ref(this, options); - token = tokens[tokens.length - 1]; - setValue(this, token, value); +function dump(input, options) { + options = options || {}; - // Return the updated object - return obj; -}; + var state = new State(options); -/** - * Parses a JSON pointer (or a path containing a JSON pointer in the hash) - * and returns an array of the pointer's tokens. - * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"]) - * - * The pointer is parsed according to RFC 6901 - * {@link https://tools.ietf.org/html/rfc6901#section-3} - * - * @param {string} path - * @returns {string[]} - */ -Pointer.parse = function(path) { - // Get the JSON pointer from the path's hash - var pointer = url.getHash(path).substr(1); + getDuplicateReferences(input, state); - // If there's no pointer, then there are no tokens, - // so return an empty array - if (!pointer) { - return []; + if (writeNode(state, 0, input, true, true)) { + return state.dump + '\n'; } + return ''; +} - // Split into an array - pointer = pointer.split('/'); +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} - // Decode each part, according to RFC 6901 - for (var i = 0; i < pointer.length; i++) { - pointer[i] = decodeURI(pointer[i].replace(escapedSlash, '/').replace(escapedTilde, '~')); - } +module.exports.dump = dump; +module.exports.safeDump = safeDump; - if (pointer[0] !== '') { - throw ono.syntax('Invalid $ref pointer "%s". Pointers must begin with "#/"', pointer); - } +},{"./common":29,"./exception":31,"./schema/default_full":36,"./schema/default_safe":37}],31:[function(require,module,exports){ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; - return pointer.slice(1); -}; -/** - * Creates a JSON pointer path, by joining one or more tokens to a base path. - * - * @param {string} base - The base path (e.g. "schema.json#/definitions/person") - * @param {string|string[]} tokens - The token(s) to append (e.g. ["name", "first"]) - * @returns {string} - */ -Pointer.join = function(base, tokens) { - // Ensure that the base path contains a hash - if (base.indexOf('#') === -1) { - base += '#'; - } +var inherits = require('inherit'); - // Append each token to the base path - tokens = Array.isArray(tokens) ? tokens : [tokens]; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - // Encode the token, according to RFC 6901 - base += '/' + encodeURI(token.replace(tildes, '~0').replace(slashes, '~1')); + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; } - return base; -}; + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); +} -/** - * If the given pointer's {@link Pointer#value} is a JSON reference, - * then the reference is resolved and {@link Pointer#value} is replaced with the resolved value. - * In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the - * resolution path of the new value. - * - * @param {Pointer} pointer - * @param {$RefParserOptions} options - * @returns {boolean} - Returns `true` if the resolution path changed - */ -function resolveIf$Ref(pointer, options) { - // Is the value a JSON reference? (and allowed?) - if ($Ref.isAllowed$Ref(pointer.value, options)) { - var $refPath = url.resolve(pointer.path, pointer.value.$ref); +// Inherit from Error +inherits(YAMLException, Error); - if ($refPath === pointer.path) { - // The value is a reference to itself, so there's nothing to do. - pointer.circular = true; - } - else { - var resolved = pointer.$ref.$refs._resolve($refPath, options); - if ($Ref.isExtended$Ref(pointer.value)) { - // This JSON reference "extends" the resolved value, rather than simply pointing to it. - // So the resolved path does NOT change. Just the value does. - pointer.value = $Ref.dereference(pointer.value, resolved.value); - } - else { - // Resolve the reference - pointer.$ref = resolved.$ref; - pointer.path = resolved.path; - pointer.value = resolved.value; - } +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; - return true; - } - } -} + result += this.reason || '(unknown reason)'; -/** - * Sets the specified token value of the {@link Pointer#value}. - * - * The token is evaluated according to RFC 6901. - * {@link https://tools.ietf.org/html/rfc6901#section-4} - * - * @param {Pointer} pointer - The JSON Pointer whose value will be modified - * @param {string} token - A JSON Pointer token that indicates how to modify `obj` - * @param {*} value - The value to assign - * @returns {*} - Returns the assigned value - */ -function setValue(pointer, token, value) { - if (pointer.value && typeof pointer.value === 'object') { - if (token === '-' && Array.isArray(pointer.value)) { - pointer.value.push(value); - } - else { - pointer.value[token] = value; - } - } - else { - throw ono.syntax('Error assigning $ref pointer "%s". \nCannot set "%s" of a non-object.', pointer.path, token); + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); } - return value; -} -},{"./ref":63,"./util/url":71,"ono":76}],63:[function(require,module,exports){ + return result; +}; + + +module.exports = YAMLException; + +},{"inherit":22}],32:[function(require,module,exports){ 'use strict'; -module.exports = $Ref; +/*eslint-disable max-len,no-use-before-define*/ -var Pointer = require('./pointer'); +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); -/** - * This class represents a single JSON reference and its resolved value. - * - * @constructor - */ -function $Ref() { - /** - * The file path or URL of the referenced file. - * This path is relative to the path of the main JSON schema file. - * - * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file. - * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get - * specific JSON pointers within the file. - * - * @type {string} - */ - this.path = undefined; - /** - * The resolved value of the JSON reference. - * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays). - * @type {?*} - */ - this.value = undefined; +var _hasOwnProperty = Object.prototype.hasOwnProperty; - /** - * The {@link $Refs} object that contains this {@link $Ref} object. - * @type {$Refs} - */ - this.$refs = undefined; - /** - * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.) - * @type {?string} - */ - this.pathType = undefined; -} +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; -/** - * Determines whether the given JSON reference exists within this {@link $Ref#value}. - * - * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} options - * @returns {boolean} - */ -$Ref.prototype.exists = function(path, options) { - try { - this.resolve(path, options); - return true; - } - catch (e) { - return false; - } -}; -/** - * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value. - * - * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} options - * @returns {*} - Returns the resolved value - */ -$Ref.prototype.get = function(path, options) { - return this.resolve(path, options).value; -}; +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; -/** - * Resolves the given JSON reference within this {@link $Ref#value}. - * - * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} options - * @returns {Pointer} - */ -$Ref.prototype.resolve = function(path, options) { - var pointer = new Pointer(this, path); - return pointer.resolve(this.value, options); -}; -/** - * Sets the value of a nested property within this {@link $Ref#value}. - * If the property, or any of its parents don't exist, they will be created. - * - * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash - * @param {*} value - The value to assign - */ -$Ref.prototype.set = function(path, value) { - var pointer = new Pointer(this, path); - this.value = pointer.set(this.value, value); -}; +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; -/** - * Determines whether the given value is a JSON reference. - * - * @param {*} value - The value to inspect - * @returns {boolean} - */ -$Ref.is$Ref = function(value) { - return value && typeof value === 'object' && typeof value.$ref === 'string' && value.$ref.length > 0; -}; -/** - * Determines whether the given value is an external JSON reference. - * - * @param {*} value - The value to inspect - * @returns {boolean} - */ -$Ref.isExternal$Ref = function(value) { - return $Ref.is$Ref(value) && value.$ref[0] !== '#'; -}; +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} -/** - * Determines whether the given value is a JSON reference, and whether it is allowed by the options. - * For example, if it references an external file, then options.resolve.external must be true. - * - * @param {*} value - The value to inspect - * @param {$RefParserOptions} options - * @returns {boolean} - */ -$Ref.isAllowed$Ref = function(value, options) { - if ($Ref.is$Ref(value)) { - if (value.$ref[0] === '#' || !options || options.resolve.external) { - return true; - } - } -}; +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} -/** - * Determines whether the given value is a JSON reference that "extends" its resolved value. - * That is, it has extra properties (in addition to "$ref"), so rather than simply pointing to - * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved - * value, plus the extra properties. - * - * @example: - * { - * person: { - * properties: { - * firstName: { type: string } - * lastName: { type: string } - * } - * } - * employee: { - * properties: { - * $ref: #/person/properties - * salary: { type: number } - * } - * } - * } - * - * In this example, "employee" is an extended $ref, since it extends "person" with an additional - * property (salary). The result is a NEW value that looks like this: - * - * { - * properties: { - * firstName: { type: string } - * lastName: { type: string } - * salary: { type: number } - * } - * } - * - * @param {*} value - The value to inspect - * @returns {boolean} - */ -$Ref.isExtended$Ref = function(value) { - return $Ref.is$Ref(value) && Object.keys(value).length > 1; -}; +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} -/** - * Returns the resolved value of a JSON Reference. - * If necessary, the resolved value is merged with the JSON Reference to create a new object - * - * @example: - * { - * person: { - * properties: { - * firstName: { type: string } - * lastName: { type: string } - * } - * } - * employee: { - * properties: { - * $ref: #/person/properties - * salary: { type: number } - * } - * } - * } - * - * When "person" and "employee" are merged, you end up with the following object: - * - * { - * properties: { - * firstName: { type: string } - * lastName: { type: string } - * salary: { type: number } - * } - * } - * - * @param {object} $ref - The JSON reference object (the one with the "$ref" property) - * @param {*} resolvedValue - The resolved value, which can be any type - * @returns {*} - Returns the dereferenced value - */ -$Ref.dereference = function($ref, resolvedValue) { - if (resolvedValue && typeof resolvedValue === 'object' && $Ref.isExtended$Ref($ref)) { - var merged = {}; - Object.keys($ref).forEach(function(key) { - if (key !== '$ref') { - merged[key] = $ref[key]; - } - }); - Object.keys(resolvedValue).forEach(function(key) { - if (!(key in merged)) { - merged[key] = resolvedValue[key]; - } - }); - return merged; - } - else { - // Completely replace the original reference with the resolved value - return resolvedValue; - } -}; +function is_FLOW_INDICATOR(c) { + return 0x2C/* , */ === c || + 0x5B/* [ */ === c || + 0x5D/* ] */ === c || + 0x7B/* { */ === c || + 0x7D/* } */ === c; +} -},{"./pointer":62}],64:[function(require,module,exports){ -'use strict'; +function fromHexCode(c) { + var lc; -var ono = require('ono'), - $Ref = require('./ref'), - url = require('./util/url'); + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } -module.exports = $Refs; + /*eslint-disable no-bitwise*/ + lc = c | 0x20; -/** - * This class is a map of JSON references and their resolved values. - */ -function $Refs() { - /** - * Indicates whether the schema contains any circular references. - * - * @type {boolean} - */ - this.circular = false; + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } - /** - * A map of paths/urls to {@link $Ref} objects - * - * @type {object} - * @protected - */ - this._$refs = {}; + return -1; +} - /** - * The {@link $Ref} object that is the root of the JSON schema. - * - * @type {$Ref} - * @protected - */ - this._root$Ref = null; +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; } -/** - * Returns the paths of all the files/URLs that are referenced by the JSON schema, - * including the schema itself. - * - * @param {...string|string[]} [types] - Only return paths of the given types ("file", "http", etc.) - * @returns {string[]} - */ -$Refs.prototype.paths = function(types) { - var paths = getPaths(this._$refs, arguments); - return paths.map(function(path) { - return path.decoded; - }); -}; +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } -/** - * Returns the map of JSON references and their resolved values. - * - * @param {...string|string[]} [types] - Only return references of the given types ("file", "http", etc.) - * @returns {object} - */ -$Refs.prototype.values = function(types) { - var $refs = this._$refs; - var paths = getPaths($refs, arguments); - return paths.reduce(function(obj, path) { - obj[path.decoded] = $refs[path.encoded].value; - return obj; - }, {}); -}; + return -1; +} -/** - * Returns a POJO (plain old JavaScript object) for serialization as JSON. - * - * @returns {object} - */ -$Refs.prototype.toJSON = $Refs.prototype.values; +function simpleEscapeSequence(c) { + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} -/** - * Determines whether the given JSON reference exists. - * - * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} [options] - * @returns {boolean} - */ -$Refs.prototype.exists = function(path, options) { - try { - this._resolve(path, options); - return true; - } - catch (e) { - return false; +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); } -}; - -/** - * Resolves the given JSON reference and returns the resolved value. - * - * @param {string} path - The path being resolved, with a JSON pointer in the hash - * @param {$RefParserOptions} [options] - * @returns {*} - Returns the resolved value - */ -$Refs.prototype.get = function(path, options) { - return this._resolve(path, options).value; -}; + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00); +} -/** - * Sets the value of a nested property within this {@link $Ref#value}. - * If the property, or any of its parents don't exist, they will be created. - * - * @param {string} path - The path of the property to set, optionally with a JSON pointer in the hash - * @param {*} value - The value to assign - */ -$Refs.prototype.set = function(path, value) { - path = url.resolve(this._root$Ref.path, path); - var withoutHash = url.stripHash(path); - var $ref = this._$refs[withoutHash]; +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} - if (!$ref) { - throw ono('Error resolving $ref pointer "%s". \n"%s" not found.', path, withoutHash); - } - $ref.set(path, value); -}; +function State(input, options) { + this.input = input; -/** - * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object. - * - * @param {string} path - The file path or URL of the referenced file - * @param {*} [value] - Optional. The value of the $ref. - */ -$Refs.prototype._add = function(path, value) { - var withoutHash = url.stripHash(path); + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; - var $ref = new $Ref(); - $ref.path = withoutHash; - $ref.value = value; - $ref.$refs = this; + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; - this._$refs[withoutHash] = $ref; - this._root$Ref = this._root$Ref || $ref; + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; - return $ref; -}; + this.documents = []; -/** - * Resolves the given JSON reference. - * - * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} [options] - * @returns {Pointer} - * @protected - */ -$Refs.prototype._resolve = function(path, options) { - path = url.resolve(this._root$Ref.path, path); - var withoutHash = url.stripHash(path); - var $ref = this._$refs[withoutHash]; + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ - if (!$ref) { - throw ono('Error resolving $ref pointer "%s". \n"%s" not found.', path, withoutHash); - } +} - return $ref.resolve(path, options); -}; -/** - * Returns the specified {@link $Ref} object, or undefined. - * - * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash - * @returns {$Ref|undefined} - * @protected - */ -$Refs.prototype._get$Ref = function(path) { - path = url.resolve(this._root$Ref.path, path); - var withoutHash = url.stripHash(path); - return this._$refs[withoutHash]; -}; +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} -/** - * Returns the encoded and decoded paths keys of the given object. - * - * @param {object} $refs - The object whose keys are URL-encoded paths - * @param {...string|string[]} [types] - Only return paths of the given types ("file", "http", etc.) - * @returns {object[]} - */ -function getPaths($refs, types) { - var paths = Object.keys($refs); +function throwError(state, message) { + throw generateError(state, message); +} - // Filter the paths by type - types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types); - if (types.length > 0 && types[0]) { - paths = paths.filter(function(key) { - return types.indexOf($refs[key].pathType) !== -1; - }); +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); } - - // Decode local filesystem paths - return paths.map(function(path) { - return { - encoded: path, - decoded: $refs[path].pathType === 'file' ? url.toFileSystemPath(path, true) : path - }; - }); } -},{"./ref":63,"./util/url":71,"ono":76}],65:[function(require,module,exports){ -'use strict'; -var Promise = require('./util/promise'), - $Ref = require('./ref'), - Pointer = require('./pointer'), - parse = require('./parse'), - debug = require('./util/debug'), - url = require('./util/url'); +var directiveHandlers = { -module.exports = resolve; + YAML: function handleYamlDirective(state, name, args) { -/** - * Crawls the JSON schema, finds all external JSON references, and resolves their values. - * This method does not mutate the JSON schema. The resolved values are added to {@link $RefParser#$refs}. - * - * NOTE: We only care about EXTERNAL references here. INTERNAL references are only relevant when dereferencing. - * - * @param {$RefParser} parser - * @param {$RefParserOptions} options - * - * @returns {Promise} - * The promise resolves once all JSON references in the schema have been resolved, - * including nested references that are contained in externally-referenced files. - */ -function resolve(parser, options) { - if (!options.resolve.external) { - // Nothing to resolve, so exit early - return Promise.resolve(); - } + var match, major, minor; - try { - debug('Resolving $ref pointers in %s', parser.$refs._root$Ref.path); - var promises = crawl(parser.schema, parser.$refs._root$Ref.path + '#', parser.$refs, options); - return Promise.all(promises); - } - catch (e) { - return Promise.reject(e); - } -} + if (null !== state.version) { + throwError(state, 'duplication of %YAML directive'); + } -/** - * Recursively crawls the given value, and resolves any external JSON references. - * - * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. - * @param {string} path - The full path of `obj`, possibly with a JSON Pointer in the hash - * @param {$Refs} $refs - * @param {$RefParserOptions} options - * - * @returns {Promise[]} - * Returns an array of promises. There will be one promise for each JSON reference in `obj`. - * If `obj` does not contain any JSON references, then the array will be empty. - * If any of the JSON references point to files that contain additional JSON references, - * then the corresponding promise will internally reference an array of promises. - */ -function crawl(obj, path, $refs, options) { - var promises = []; + if (1 !== args.length) { + throwError(state, 'YAML directive accepts exactly one argument'); + } - if (obj && typeof obj === 'object') { - if ($Ref.isExternal$Ref(obj)) { - promises.push(resolve$Ref(obj, path, $refs, options)); - } - else { - Object.keys(obj).forEach(function(key) { - var keyPath = Pointer.join(path, key); - var value = obj[key]; + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - if ($Ref.isExternal$Ref(value)) { - promises.push(resolve$Ref(value, keyPath, $refs, options)); - } - else { - promises = promises.concat(crawl(value, keyPath, $refs, options)); - } - }); - } - } + if (null === match) { + throwError(state, 'ill-formed argument of the YAML directive'); + } - return promises; -} + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); -/** - * Resolves the given JSON Reference, and then crawls the resulting value. - * - * @param {{$ref: string}} $ref - The JSON Reference to resolve - * @param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash - * @param {$Refs} $refs - * @param {$RefParserOptions} options - * - * @returns {Promise} - * The promise resolves once all JSON references in the object have been resolved, - * including nested references that are contained in externally-referenced files. - */ -function resolve$Ref($ref, path, $refs, options) { - debug('Resolving $ref pointer "%s" at %s', $ref.$ref, path); + if (1 !== major) { + throwError(state, 'unacceptable YAML version of the document'); + } - var resolvedPath = url.resolve(path, $ref.$ref); - var withoutHash = url.stripHash(resolvedPath); + state.version = args[0]; + state.checkLineBreaks = (minor < 2); - // Do we already have this $ref? - $ref = $refs._get$Ref(withoutHash); - if ($ref) { - // We've already parsed this $ref, so use the existing value - return Promise.resolve($ref.value); - } + if (1 !== minor && 2 !== minor) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, - // Parse the $referenced file/url - return parse(resolvedPath, $refs, options) - .then(function(result) { - // Crawl the parsed value - debug('Resolving $ref pointers in %s', withoutHash); - var promises = crawl(result, withoutHash + '#', $refs, options); - return Promise.all(promises); - }); -} + TAG: function handleTagDirective(state, name, args) { -},{"./parse":57,"./pointer":62,"./ref":63,"./util/debug":68,"./util/promise":70,"./util/url":71}],66:[function(require,module,exports){ -'use strict'; -var fs = require('fs'), - ono = require('ono'), - Promise = require('../util/promise'), - url = require('../util/url'), - debug = require('../util/debug'); + var handle, prefix; -module.exports = { - /** - * The order that this resolver will run, in relation to other resolvers. - * - * @type {number} - */ - order: 100, + if (2 !== args.length) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } - /** - * Determines whether this resolver can read a given file reference. - * Resolvers that return true will be tried, in order, until one successfully resolves the file. - * Resolvers that return false will not be given a chance to resolve the file. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @returns {boolean} - */ - canRead: function isFile(file) { - return url.isFileSystemPath(file.url); - }, + handle = args[0]; + prefix = args[1]; - /** - * Reads the given file and returns its raw contents as a Buffer. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @returns {Promise} - */ - read: function readFile(file) { - return new Promise(function(resolve, reject) { - var path; - try { - path = url.toFileSystemPath(file.url); + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); } - catch (err) { - reject(ono.uri(err, 'Malformed URI: %s', file.url)); - } - - debug('Opening file: %s', path); - try { - fs.readFile(path, function(err, data) { - if (err) { - reject(ono(err, 'Error opening file "%s"', path)); - } - else { - resolve(data); - } - }); + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); } - catch (err) { - reject(ono(err, 'Error opening file "%s"', path)); + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); } - }); - } + + state.tagMap[handle] = prefix; + } }; -},{"../util/debug":68,"../util/promise":70,"../util/url":71,"fs":9,"ono":76}],67:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; -var http = require('http'), - https = require('https'), - ono = require('ono'), - url = require('../util/url'), - debug = require('../util/debug'), - Promise = require('../util/promise'); +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; -module.exports = { - /** - * The order that this resolver will run, in relation to other resolvers. - * - * @type {number} - */ - order: 200, + if (start < end) { + _result = state.input.slice(start, end); - /** - * HTTP headers to send when downloading files. - * - * @example: - * { - * "User-Agent": "JSON Schema $Ref Parser", - * Accept: "application/json" - * } - * - * @type {object} - */ - headers: null, + if (checkJson) { + for (_position = 0, _length = _result.length; + _position < _length; + _position += 1) { + _character = _result.charCodeAt(_position); + if (!(0x09 === _character || + 0x20 <= _character && _character <= 0x10FFFF)) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } - /** - * HTTP request timeout (in milliseconds). - * - * @type {number} - */ - timeout: 5000, // 5 seconds + state.result += _result; + } +} - /** - * The maximum number of HTTP redirects to follow. - * To disable automatic following of redirects, set this to zero. - * - * @type {number} - */ - redirects: 5, +function mergeMappings(state, destination, source) { + var sourceKeys, key, index, quantity; - /** - * The `withCredentials` option of XMLHttpRequest. - * Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication - * - * @type {boolean} - */ - withCredentials: false, + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } - /** - * Determines whether this resolver can read a given file reference. - * Resolvers that return true will be tried in order, until one successfully resolves the file. - * Resolvers that return false will not be given a chance to resolve the file. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @returns {boolean} - */ - canRead: function isHttp(file) { - return url.isHttp(file.url); - }, + sourceKeys = Object.keys(source); - /** - * Reads the given URL and returns its raw contents as a Buffer. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @returns {Promise} - */ - read: function readHttp(file) { - var u = url.parse(file.url); + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; - if (process.browser && !u.protocol) { - // Use the protocol of the current page - u.protocol = url.parse(location.href).protocol; + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; } + } +} + +function storeMappingPair(state, _result, keyTag, keyNode, valueNode) { + var index, quantity; + + keyNode = String(keyNode); - return download(u, this); + if (null === _result) { + _result = {}; } -}; -/** - * Downloads the given file. - * - * @param {Url|string} u - The url to download (can be a parsed {@link Url} object) - * @param {object} httpOptions - The `options.resolve.http` object - * @param {number} [redirects] - The redirect URLs that have already been followed - * - * @returns {Promise} - * The promise resolves with the raw downloaded data, or rejects if there is an HTTP error. - */ -function download(u, httpOptions, redirects) { - return new Promise(function(resolve, reject) { - u = url.parse(u); - redirects = redirects || []; - redirects.push(u.href); + if ('tag:yaml.org,2002:merge' === keyTag) { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index]); + } + } else { + mergeMappings(state, _result, valueNode); + } + } else { + _result[keyNode] = valueNode; + } - get(u, httpOptions) - .then(function(res) { - if (res.statusCode >= 400) { - throw ono({status: res.statusCode}, 'HTTP ERROR %d', res.statusCode); - } - else if (res.statusCode >= 300) { - if (redirects.length > httpOptions.redirects) { - reject(ono({status: res.statusCode}, 'Error downloading %s. \nToo many redirects: \n %s', - redirects[0], redirects.join(' \n '))); - } - else if (!res.headers.location) { - throw ono({status: res.statusCode}, 'HTTP %d redirect with no location header', res.statusCode); - } - else { - debug('HTTP %d redirect %s -> %s', res.statusCode, u.href, res.headers.location); - var redirectTo = url.resolve(u, res.headers.location); - download(redirectTo, httpOptions, redirects).then(resolve, reject); - } - } - else { - resolve(res.body || new Buffer(0)); - } - }) - .catch(function(err) { - reject(ono(err, 'Error downloading', u.href)); - }); - }); + return _result; } -/** - * Sends an HTTP GET request. - * - * @param {Url} u - A parsed {@link Url} object - * @param {object} httpOptions - The `options.resolve.http` object - * - * @returns {Promise} - * The promise resolves with the HTTP Response object. - */ -function get(u, httpOptions) { - return new Promise(function(resolve, reject) { - debug('GET', u.href); - - var protocol = u.protocol === 'https:' ? https : http; - var req = protocol.get({ - hostname: u.hostname, - port: u.port, - path: u.path, - auth: u.auth, - headers: httpOptions.headers || {}, - withCredentials: httpOptions.withCredentials - }); +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); - if (typeof req.setTimeout === 'function') { - req.setTimeout(httpOptions.timeout); + if (0x0A/* LF */ === ch) { + state.position++; + } else if (0x0D/* CR */ === ch) { + state.position++; + if (0x0A/* LF */ === state.input.charCodeAt(state.position)) { + state.position++; } + } else { + throwError(state, 'a line break is expected'); + } - req.on('timeout', function() { - req.abort(); - }); + state.line += 1; + state.lineStart = state.position; +} - req.on('error', reject); +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); - req.once('response', function(res) { - res.body = new Buffer(0); + while (0 !== ch) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } - res.on('data', function(data) { - res.body = Buffer.concat([res.body, new Buffer(data)]); - }); + if (allowComments && 0x23/* # */ === ch) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch); + } - res.on('error', reject); + if (is_EOL(ch)) { + readLineBreak(state); - res.on('end', function() { - resolve(res); - }); - }); - }); + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (0x20/* Space */ === ch) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; } -}).call(this,require('_process'),require("buffer").Buffer) +function testDocumentSeparator(state) { + var _position = state.position, + ch; -},{"../util/debug":68,"../util/promise":70,"../util/url":71,"_process":78,"buffer":10,"http":94,"https":18,"ono":76}],68:[function(require,module,exports){ -'use strict'; + ch = state.input.charCodeAt(_position); -var debug = require('debug'); + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) && + state.input.charCodeAt(_position + 1) === ch && + state.input.charCodeAt(_position + 2) === ch) { -/** - * Writes messages to stdout. - * Log messages are suppressed by default, but can be enabled by setting the DEBUG variable. - * @type {function} - */ -module.exports = debug('json-schema-ref-parser'); + _position += 3; -},{"debug":14}],69:[function(require,module,exports){ -'use strict'; + ch = state.input.charCodeAt(_position); -var Promise = require('./promise'), - debug = require('./debug'); + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } -/** - * Returns the given plugins as an array, rather than an object map. - * All other methods in this module expect an array of plugins rather than an object map. - * - * @param {object} plugins - A map of plugin objects - * @return {object[]} - */ -exports.all = function(plugins) { - return Object.keys(plugins) - .filter(function(key) { - return typeof plugins[key] === 'object'; - }) - .map(function(key) { - plugins[key].name = key; - return plugins[key]; - }); -}; + return false; +} -/** - * Filters the given plugins, returning only the ones return `true` for the given method. - * - * @param {object[]} plugins - An array of plugin objects - * @param {string} method - The name of the filter method to invoke for each plugin - * @param {object} file - A file info object, which will be passed to each method - * @return {object[]} - */ -exports.filter = function(plugins, method, file) { - return plugins - .filter(function(plugin) { - return !!getResult(plugin, method, file); - }); -}; +function writeFoldedLines(state, count) { + if (1 === count) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} -/** - * Sorts the given plugins, in place, by their `order` property. - * - * @param {object[]} plugins - An array of plugin objects - * @returns {object[]} - */ -exports.sort = function(plugins) { - plugins.forEach(function(plugin) { - plugin.order = plugin.order || Number.MAX_SAFE_INTEGER; - }); - return plugins.sort(function(a, b) { return a.order - b.order; }); -}; +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; -/** - * Runs the specified method of the given plugins, in order, until one of them returns a successful result. - * Each method can return a synchronous value, a Promise, or call an error-first callback. - * If the promise resolves successfully, or the callback is called without an error, then the result - * is immediately returned and no further plugins are called. - * If the promise rejects, or the callback is called with an error, then the next plugin is called. - * If ALL plugins fail, then the last error is thrown. - * - * @param {object[]} plugins - An array of plugin objects - * @param {string} method - The name of the method to invoke for each plugin - * @param {object} file - A file info object, which will be passed to each method - * @returns {Promise} - */ -exports.run = function(plugins, method, file) { - var plugin, lastError, index = 0; + ch = state.input.charCodeAt(state.position); - return new Promise(function(resolve, reject) { - runNextPlugin(); + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + 0x23/* # */ === ch || + 0x26/* & */ === ch || + 0x2A/* * */ === ch || + 0x21/* ! */ === ch || + 0x7C/* | */ === ch || + 0x3E/* > */ === ch || + 0x27/* ' */ === ch || + 0x22/* " */ === ch || + 0x25/* % */ === ch || + 0x40/* @ */ === ch || + 0x60/* ` */ === ch) { + return false; + } - function runNextPlugin() { - plugin = plugins[index++]; - if (!plugin) { - // There are no more functions, so re-throw the last error - return reject(lastError); - } + if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) { + following = state.input.charCodeAt(state.position + 1); - try { - debug(' %s', plugin.name); - var result = getResult(plugin, method, file, callback); - if (result && typeof result.then === 'function') { - // A promise was returned - result.then(onSuccess, onError); - } - else if (result !== undefined) { - // A synchronous result was returned - onSuccess(result); - } - // else { the callback will be called } - } - catch (e) { - onError(e); - } + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; } + } - function callback(err, result) { - if (err) { - onError(err); + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (0 !== ch) { + if (0x3A/* : */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; } - else { - onSuccess(result); + + } else if (0x23/* # */ === ch) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; } - } - function onSuccess(result) { - debug(' success'); - resolve({ - plugin: plugin, - result: result - }); + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } } - function onError(err) { - debug(' %s', err.message || err); - lastError = err; - runNextPlugin(); + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; } - }); -}; -/** - * Returns the value of the given property. - * If the property is a function, then the result of the function is returned. - * If the value is a RegExp, then it will be tested against the file URL. - * If the value is an aray, then it will be compared against the file extension. - * - * @param {object} obj - The object whose property/method is called - * @param {string} prop - The name of the property/method to invoke - * @param {object} file - A file info object, which will be passed to the method - * @param {function} [callback] - A callback function, which will be passed to the method - * @returns {*} - */ -function getResult(obj, prop, file, callback) { - var value = obj[prop]; + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } - if (typeof value === 'function') { - return value.apply(obj, [file, callback]); + ch = state.input.charCodeAt(++state.position); } - if (!callback) { - // The synchronous plugin functions (canParse and canRead) - // allow a "shorthand" syntax, where the user can match - // files by RegExp or by file extension. - if (value instanceof RegExp) { - return value.test(file.url); - } - else if (typeof value === 'string') { - return value === file.extension; - } - else if (Array.isArray(value)) { - return value.indexOf(file.extension) !== -1; - } + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; } - return value; + state.kind = _kind; + state.result = _result; + return false; } -},{"./debug":68,"./promise":70}],70:[function(require,module,exports){ -arguments[4][3][0].apply(exports,arguments) -},{"dup":3,"es6-promise":16}],71:[function(require,module,exports){ -(function (process){ -'use strict'; +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; -var isWindows = /^win/.test(process.platform), - forwardSlashPattern = /\//g, - protocolPattern = /^([a-z0-9.+-]+):\/\//i, - url = module.exports; + ch = state.input.charCodeAt(state.position); -// RegExp patterns to URL-encode special characters in local filesystem paths -var urlEncodePatterns = [ - /\?/g, '%3F', - /\#/g, '%23', - isWindows ? /\\/g : /\//, '/' -]; + if (0x27/* ' */ !== ch) { + return false; + } -// RegExp patterns to URL-decode special characters for local filesystem paths -var urlDecodePatterns = [ - /\%23/g, '#', - /\%24/g, '$', - /\%26/g, '&', - /\%2C/g, ',', - /\%40/g, '@' -]; + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; -exports.parse = require('url').parse; -exports.resolve = require('url').resolve; + while (0 !== (ch = state.input.charCodeAt(state.position))) { + if (0x27/* ' */ === ch) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); -/** - * Returns the current working directory (in Node) or the current page URL (in browsers). - * - * @returns {string} - */ -exports.cwd = function cwd() { - return process.browser ? location.href : process.cwd() + '/'; -}; + if (0x27/* ' */ === ch) { + captureStart = captureEnd = state.position; + state.position++; + } else { + return true; + } -/** - * Returns the protocol of the given URL, or `undefined` if it has no protocol. - * - * @param {string} path - * @returns {?string} - */ -exports.getProtocol = function getProtocol(path) { - var match = protocolPattern.exec(path); - if (match) { - return match[1].toLowerCase(); - } -}; + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; -/** - * Returns the lowercased file extension of the given URL, - * or an empty string if it has no extension. - * - * @param {string} path - * @returns {string} - */ -exports.getExtension = function getExtension(path) { - var lastDot = path.lastIndexOf('.'); - if (lastDot >= 0) { - return path.substr(lastDot).toLowerCase(); - } - return ''; -}; + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); -/** - * Returns the hash (URL fragment), of the given path. - * If there is no hash, then the root hash ("#") is returned. - * - * @param {string} path - * @returns {string} - */ -exports.getHash = function getHash(path) { - var hashIndex = path.indexOf('#'); - if (hashIndex >= 0) { - return path.substr(hashIndex); + } else { + state.position++; + captureEnd = state.position; + } } - return '#'; -}; -/** - * Removes the hash (URL fragment), if any, from the given path. - * - * @param {string} path - * @returns {string} - */ -exports.stripHash = function stripHash(path) { - var hashIndex = path.indexOf('#'); - if (hashIndex >= 0) { - path = path.substr(0, hashIndex); - } - return path; -}; + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} -/** - * Determines whether the given path is an HTTP(S) URL. - * - * @param {string} path - * @returns {boolean} - */ -exports.isHttp = function isHttp(path) { - var protocol = url.getProtocol(path); - if (protocol === 'http' || protocol === 'https') { - return true; - } - else if (protocol === undefined) { - // There is no protocol. If we're running in a browser, then assume it's HTTP. - return process.browser; - } - else { - // It's some other protocol, such as "ftp://", "mongodb://", etc. - return false; - } -}; +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; -/** - * Determines whether the given path is a filesystem path. - * This includes "file://" URLs. - * - * @param {string} path - * @returns {boolean} - */ -exports.isFileSystemPath = function isFileSystemPath(path) { - if (process.browser) { - // We're running in a browser, so assume that all paths are URLs. - // This way, even relative paths will be treated as URLs rather than as filesystem paths + ch = state.input.charCodeAt(state.position); + + if (0x22/* " */ !== ch) { return false; } - var protocol = url.getProtocol(path); - return protocol === undefined || protocol === 'file'; -}; - -/** - * Converts a filesystem path to a properly-encoded URL. - * - * This is intended to handle situations where JSON Schema $Ref Parser is called - * with a filesystem path that contains characters which are not allowed in URLs. - * - * @example - * The following filesystem paths would be converted to the following URLs: - * - * <"!@#$%^&*+=?'>.json ==> %3C%22!@%23$%25%5E&*+=%3F\'%3E.json - * C:\\My Documents\\File (1).json ==> C:/My%20Documents/File%20(1).json - * file://Project #42/file.json ==> file://Project%20%2342/file.json - * - * @param {string} path - * @returns {string} - */ -exports.fromFileSystemPath = function fromFileSystemPath(path) { - // Step 1: Manually encode characters that are not encoded by `encodeURI`. - // This includes characters such as "#" and "?", which have special meaning in URLs, - // but are just normal characters in a filesystem path. - // On Windows, this will also replace backslashes with forward slashes, - // rather than encoding them as special characters. - for (var i = 0; i < urlEncodePatterns.length; i += 2) { - path = path.replace(urlEncodePatterns[i], urlEncodePatterns[i + 1]); - } - - // Step 2: `encodeURI` will take care of all other characters - return encodeURI(path); -}; + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; -/** - * Converts a URL to a local filesystem path. - * - * @param {string} path - * @param {boolean} [keepFileProtocol] - If true, then "file://" will NOT be stripped - * @returns {string} - */ -exports.toFileSystemPath = function toFileSystemPath(path, keepFileProtocol) { - // Step 1: `decodeURI` will decode characters such as Cyrillic characters, spaces, etc. - path = decodeURI(path); + while (0 !== (ch = state.input.charCodeAt(state.position))) { + if (0x22/* " */ === ch) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; - // Step 2: Manually decode characters that are not decoded by `decodeURI`. - // This includes characters such as "#" and "?", which have special meaning in URLs, - // but are just normal characters in a filesystem path. - for (var i = 0; i < urlDecodePatterns.length; i += 2) { - path = path.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]); - } + } else if (0x5C/* \ */ === ch) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); - // Step 3: If it's a "file://" URL, then format it consistently - // or convert it to a local filesystem path - var isFileUrl = path.substr(0, 7).toLowerCase() === 'file://'; - if (isFileUrl) { - // Strip-off the protocol, and the initial "/", if there is one - path = path[7] === '/' ? path.substr(8) : path.substr(7); + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); - // insert a colon (":") after the drive letter on Windows - if (isWindows && path[1] === '/') { - path = path[0] + ':' + path.substr(1); - } + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; - if (keepFileProtocol) { - // Return the consistently-formatted "file://" URL - path = 'file:///' + path; - } - else { - // Convert the "file://" URL to a local filesystem path. - // On Windows, it will start with something like "C:/". - // On Posix, it will start with "/" - isFileUrl = false; - path = isWindows ? path : '/' + path; - } - } + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; - // Step 4: On Windows, convert backslashes to forward slashes, - // unless it's a "file://" URL - if (isWindows && !isFileUrl) { - path = path.replace(forwardSlashPattern, '\\'); - } + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); - return path; -}; + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; -}).call(this,require('_process')) + } else { + throwError(state, 'expected hexadecimal character'); + } + } -},{"_process":78,"url":102}],72:[function(require,module,exports){ -/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ -'use strict'; + state.result += charFromCodepoint(hexResult); -var yaml = require('js-yaml'), - ono = require('ono'); + state.position++; -/** - * Simple YAML parsing functions, similar to {@link JSON.parse} and {@link JSON.stringify} - */ -module.exports = { - /** - * Parses a YAML string and returns the value. - * - * @param {string} text - The YAML string to be parsed - * @param {function} [reviver] - Not currently supported. Provided for consistency with {@link JSON.parse} - * @returns {*} - */ - parse: function yamlParse(text, reviver) { - try { - return yaml.safeLoad(text); - } - catch (e) { - if (e instanceof Error) { - throw e; - } - else { - // https://github.com/nodeca/js-yaml/issues/153 - throw ono(e, e.message); + } else { + throwError(state, 'unknown escape sequence'); } - } - }, - /** - * Converts a JavaScript value to a YAML string. - * - * @param {*} value - The value to convert to YAML - * @param {function|array} replacer - Not currently supported. Provided for consistency with {@link JSON.stringify} - * @param {string|number} space - The number of spaces to use for indentation, or a string containing the number of spaces. - * @returns {string} - */ - stringify: function yamlStringify(value, replacer, space) { - try { - var indent = (typeof space === 'string' ? space.length : space) || 2; - return yaml.safeDump(value, {indent: indent}); - } - catch (e) { - if (e instanceof Error) { - throw e; - } - else { - // https://github.com/nodeca/js-yaml/issues/153 - throw ono(e, e.message); - } + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; } } -}; -},{"js-yaml":23,"ono":76}],73:[function(require,module,exports){ -(function (global){ -/** - * lodash 4.7.1 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + keyNode, + keyTag, + valueNode, + ch; -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; + ch = state.input.charCodeAt(state.position); -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - symbolTag = '[object Symbol]'; + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } -/** Used to match property names within property paths. */ -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + ch = state.input.charCodeAt(++state.position); -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + while (0 !== ch) { + skipSeparationSpace(state, true, nodeIndent); -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + ch = state.input.charCodeAt(state.position); -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; -/** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; + if (0x3F/* ? */ === ch) { + following = state.input.charCodeAt(state.position + 1); -/** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } -/** Detect free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); + ch = state.input.charCodeAt(state.position); -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); + if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + if (isMapping) { + storeMappingPair(state, _result, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); + skipSeparationSpace(state, true, nodeIndent); -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} + ch = state.input.charCodeAt(state.position); -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} + if (0x2C/* , */ === ch) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } } - return result; -} -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - objectProto = Object.prototype; + throwError(state, 'unexpected end of the stream within a flow collection'); +} -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; + ch = state.input.charCodeAt(state.position); -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); + state.kind = 'scalar'; + state.result = ''; -/** Built-in value references. */ -var Symbol = root.Symbol, - splice = arrayProto.splice; + while (0 !== ch) { + ch = state.input.charCodeAt(++state.position); -/* Built-in method references that are verified to be native. */ -var Map = getNative(root, 'Map'), - nativeCreate = getNative(Object, 'create'); + if (0x2B/* + */ === ch || 0x2D/* - */ === ch) { + if (CHOMPING_CLIP === chomping) { + chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } -/** - * Creates a hash object. - * - * @private - * @constructor - * @returns {Object} Returns the new hash object. - */ -function Hash() {} + } else { + break; + } + } -/** - * Removes `key` and its value from the hash. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(hash, key) { - return hashHas(hash, key) && delete hash[key]; -} + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); -/** - * Gets the hash value for `key`. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(hash, key) { - if (nativeCreate) { - var result = hash[key]; - return result === HASH_UNDEFINED ? undefined : result; + if (0x23/* # */ === ch) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (0 !== ch)); + } } - return hasOwnProperty.call(hash, key) ? hash[key] : undefined; -} -/** - * Checks if a hash value for `key` exists. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(hash, key) { - return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); -} + while (0 !== ch) { + readLineBreak(state); + state.lineIndent = 0; -/** - * Sets the hash `key` to `value`. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function hashSet(hash, key, value) { - hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; -} + ch = state.input.charCodeAt(state.position); -// Avoid inheriting from `Object.prototype` when possible. -Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; + while ((!detectedIndent || state.lineIndent < textIndent) && + (0x20/* Space */ === ch)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function MapCache(values) { - var index = -1, - length = values ? values.length : 0; + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } - this.clear(); - while (++index < length) { - var entry = values[index]; - this.set(entry[0], entry[1]); - } -} + if (is_EOL(ch)) { + emptyLines++; + continue; + } -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapClear() { - this.__data__ = { - 'hash': new Hash, - 'map': Map ? new Map : [], - 'string': new Hash - }; -} + // End of the scalar. + if (state.lineIndent < textIndent) { -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapDelete(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashDelete(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map['delete'](key) : assocDelete(data.map, key); -} + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (detectedIndent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapGet(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashGet(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.get(key) : assocGet(data.map, key); -} + // Break this `while` cycle and go to the funciton's epilogue. + break; + } -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapHas(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashHas(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.has(key) : assocHas(data.map, key); -} + // Folded style: use fancy rules to handle line breaks. + if (folding) { -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapSet(key, value) { - var data = this.__data__; - if (isKeyable(key)) { - hashSet(typeof key == 'string' ? data.string : data.hash, key, value); - } else if (Map) { - data.map.set(key, value); - } else { - assocSet(data.map, key, value); - } - return this; -} + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + state.result += common.repeat('\n', emptyLines + 1); -// Add methods to `MapCache`. -MapCache.prototype.clear = mapClear; -MapCache.prototype['delete'] = mapDelete; -MapCache.prototype.get = mapGet; -MapCache.prototype.has = mapHas; -MapCache.prototype.set = mapSet; + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); -/** - * Removes `key` and its value from the associative array. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function assocDelete(array, key) { - var index = assocIndexOf(array, key); - if (index < 0) { - return false; - } - var lastIndex = array.length - 1; - if (index == lastIndex) { - array.pop(); - } else { - splice.call(array, index, 1); + // Just one line break - perceive as the same line. + } else if (0 === emptyLines) { + if (detectedIndent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else if (detectedIndent) { + // If current line isn't the first one - count line break from the last content line. + state.result += common.repeat('\n', emptyLines + 1); + } else { + // In case of the first content line - count only empty lines. + state.result += common.repeat('\n', emptyLines); + } + + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (0 !== ch)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); } + return true; } -/** - * Gets the associative array value for `key`. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function assocGet(array, key) { - var index = assocIndexOf(array, key); - return index < 0 ? undefined : array[index][1]; -} - -/** - * Checks if an associative array value for `key` exists. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function assocHas(array, key) { - return assocIndexOf(array, key) > -1; -} +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to search. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; } - return -1; -} -/** - * Sets the associative array `key` to `value`. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function assocSet(array, key, value) { - var index = assocIndexOf(array, key); - if (index < 0) { - array.push([key, value]); - } else { - array[index][1] = value; - } -} + ch = state.input.charCodeAt(state.position); -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; -} + while (0 !== ch) { -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; -} + if (0x2D/* - */ !== ch) { + break; + } -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -var stringToPath = memoize(function(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -}); + following = state.input.charCodeAt(state.position + 1); -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to process. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} + if (!is_WS_OR_EOL(following)) { + break; + } -/** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) - * method interface of `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */ -function memoize(func, resolver) { - if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; + detected = true; + state.position++; - if (cache.has(key)) { - return cache.get(key); + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result); - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; -} -// Assign cache to `_.memoize`. -memoize.Cache = MapCache; + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); -/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} + ch = state.input.charCodeAt(state.position); -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} + if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; } -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (!isObject(value)) { - return false; + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); -} -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} + ch = state.input.charCodeAt(state.position); -/** - * Converts `value` to a string if it's not one. An empty string is returned - * for `null` and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ -function toString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (value == null) { - return ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} + while (0 !== ch) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. -module.exports = stringToPath; + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) { -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + if (0x3F/* ? */ === ch) { + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } -},{}],74:[function(require,module,exports){ -/** - * lodash 4.2.0 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -var stringToPath = require('lodash._stringtopath'); + detected = true; + atExplicitKey = true; + allowCompact = true; -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/; + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed'); + } -/** Used for built-in method references. */ -var objectProto = Object.prototype; + state.position += 1; + ch = following; -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { -/** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast property path array. - */ -function baseCastPath(value) { - return isArray(value) ? value : stringToPath(value); -} + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path] : baseCastPath(path); + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } - var index = 0, - length = path.length; + if (0x3A/* : */ === ch) { + ch = state.input.charCodeAt(++state.position); - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - var type = typeof value; - if (type == 'number' || type == 'symbol') { - return true; - } - return !isArray(value) && - (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @type {Function} - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } -/** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined` the `defaultValue` is used in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ -function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; -} + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); -module.exports = get; + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } -},{"lodash._stringtopath":73}],75:[function(require,module,exports){ -/** - * Helpers. - */ + } else { + break; // Reading is done. Go to the epilogue. + } -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ + if (!atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, valueNode); + keyTag = keyNode = valueNode = null; + } -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ + if (state.lineIndent > nodeIndent && (0 !== ch)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } -function parse(str) { - str = '' + str; - if (str.length > 10000) return; - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); } -} -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; + return detected; } -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} + ch = state.input.charCodeAt(state.position); -/** - * Pluralization helper. - */ + if (0x21/* ! */ !== ch) { + return false; + } -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} + if (null !== state.tag) { + throwError(state, 'duplication of a tag property'); + } -},{}],76:[function(require,module,exports){ -/**! - * Ono v2.2.1 - * - * @link https://github.com/BigstickCarpet/ono - * @license MIT - */ -'use strict'; + ch = state.input.charCodeAt(++state.position); -var util = require('util'), - slice = Array.prototype.slice, - vendorSpecificErrorProperties = [ - 'name', 'message', 'description', 'number', 'fileName', 'lineNumber', 'columnNumber', - 'sourceURL', 'line', 'column', 'stack' - ]; + if (0x3C/* < */ === ch) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); -module.exports = create(Error); -module.exports.error = create(Error); -module.exports.eval = create(EvalError); -module.exports.range = create(RangeError); -module.exports.reference = create(ReferenceError); -module.exports.syntax = create(SyntaxError); -module.exports.type = create(TypeError); -module.exports.uri = create(URIError); -module.exports.formatter = util.format; + } else if (0x21/* ! */ === ch) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); -/** - * Creates a new {@link ono} function that creates the given Error class. - * - * @param {Class} Klass - The Error subclass to create - * @returns {ono} - */ -function create(Klass) { - /** - * @param {Error} [err] - The original error, if any - * @param {object} [props] - An object whose properties will be added to the error object - * @param {string} [message] - The error message. May contain {@link util#format} placeholders - * @param {...*} [params] - Parameters that map to the `message` placeholders - * @returns {Error} - */ - return function ono(err, props, message, params) { - var formattedMessage; - var formatter = module.exports.formatter; + } else { + tagHandle = '!'; + } - if (typeof(err) === 'string') { - formattedMessage = formatter.apply(null, arguments); - err = props = undefined; - } - else if (typeof(props) === 'string') { - formattedMessage = formatter.apply(null, slice.call(arguments, 1)); - } - else { - formattedMessage = formatter.apply(null, slice.call(arguments, 2)); + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (0 !== ch && 0x3E/* > */ !== ch); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); } + } else { + while (0 !== ch && !is_WS_OR_EOL(ch)) { - if (!(err instanceof Error)) { - props = err; - err = undefined; + if (0x21/* ! */ === ch) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); } - if (err) { - // The inner-error's message will be added to the new message - formattedMessage += (formattedMessage ? ' \n' : '') + err.message; + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); } + } - // Create the new error - // NOTE: DON'T move this to a separate function! We don't want to pollute the stack trace - var newError = new Klass(formattedMessage); + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } - // Extend the new error with the additional properties - extendError(newError, err); // Copy properties of the original error - extendToJSON(newError); // Replace the original toJSON method - extend(newError, props); // Copy custom properties, possibly including a custom toJSON method + if (isVerbatim) { + state.tag = tagName; - return newError; - }; -} + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; -/** - * Extends the targetError with the properties of the source error. - * - * @param {Error} targetError - The error object to extend - * @param {?Error} sourceError - The source error object, if any - */ -function extendError(targetError, sourceError) { - if (sourceError) { - extendStack(targetError, sourceError); - extend(targetError, sourceError, true); - } -} + } else if ('!' === tagHandle) { + state.tag = '!' + tagName; -/** - * JavaScript engines differ in how errors are serialized to JSON - especially when it comes - * to custom error properties and stack traces. So we add our own toJSON method that ALWAYS - * outputs every property of the error. - */ -function extendToJSON(error) { - error.toJSON = errorToJSON; + } else if ('!!' === tagHandle) { + state.tag = 'tag:yaml.org,2002:' + tagName; - // Also add an inspect() method, for compatibility with Node.js' `util.inspect()` method - error.inspect = errorToString; + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; } -/** - * Extends the target object with the properties of the source object. - * - * @param {object} target - The object to extend - * @param {?source} source - The object whose properties are copied - * @param {boolean} omitVendorSpecificProperties - Skip vendor-specific Error properties - */ -function extend(target, source, omitVendorSpecificProperties) { - if (source && typeof(source) === 'object') { - var keys = Object.keys(source); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; +function readAnchorProperty(state) { + var _position, + ch; - // Don't bother trying to copy read-only vendor-specific Error properties - if (omitVendorSpecificProperties && vendorSpecificErrorProperties.indexOf(key) >= 0) { - continue; - } + ch = state.input.charCodeAt(state.position); - try { - target[key] = source[key]; - } - catch (e) { - // This property is read-only, so it can't be copied - } - } + if (0x26/* & */ !== ch) { + return false; } -} -/** - * Custom JSON serializer for Error objects. - * Returns all built-in error properties, as well as extended properties. - * - * @returns {object} - */ -function errorToJSON() { - // jshint -W040 - var json = {}; - - // Get all the properties of this error - var keys = Object.keys(this); - - // Also include vendor-specific properties from the prototype - keys = keys.concat(vendorSpecificErrorProperties); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = this[key]; - var type = typeof value; - if (type !== 'undefined' && type !== 'function') { - json[key] = value; - } + if (null !== state.anchor) { + throwError(state, 'duplication of an anchor property'); } - return json; -} - -/** - * Serializes Error objects as human-readable JSON strings for debugging/logging purposes. - * - * @returns {string} - */ -function errorToString() { - // jshint -W040 - return JSON.stringify(this, null, 2).replace(/\\n/g, '\n'); -} + ch = state.input.charCodeAt(++state.position); + _position = state.position; -/** - * Extend the error stack to include its cause - */ -function extendStack(targetError, sourceError) { - if (hasLazyStack(sourceError)) { - extendStackProperty(targetError, sourceError); + while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); } - else { - var stack = sourceError.stack; - if (stack) { - targetError.stack += ' \n\n' + sourceError.stack; - } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); } + + state.anchor = state.input.slice(_position, state.position); + return true; } -/** - * Does a one-time determination of whether this JavaScript engine - * supports lazy `Error.stack` properties. - */ -var supportsLazyStack = (function() { - return !!( - // ES5 property descriptors must be supported - Object.getOwnPropertyDescriptor && Object.defineProperty && +function readAlias(state) { + var _position, alias, + ch; - // Chrome on Android doesn't support lazy stacks :( - (typeof navigator === 'undefined' || !/Android/.test(navigator.userAgent)) - ); -})(); + ch = state.input.charCodeAt(state.position); -/** - * Does this error have a lazy stack property? - * - * @returns {boolean} - */ -function hasLazyStack(err) { - if (!supportsLazyStack) { - return false; - } - var descriptor = Object.getOwnPropertyDescriptor(err, 'stack'); - if (!descriptor) { + if (0x2A/* * */ !== ch) { return false; } - return typeof descriptor.get === 'function'; -} -/** - * Extend the error stack to include its cause, lazily - */ -function extendStackProperty(targetError, sourceError) { - var sourceStack = Object.getOwnPropertyDescriptor(sourceError, 'stack'); - if (sourceStack) { - var targetStack = Object.getOwnPropertyDescriptor(targetError, 'stack'); - Object.defineProperty(targetError, 'stack', { - get: function() { - return targetStack.get.apply(targetError) + ' \n\n' + sourceError.stack; - }, - enumerable: false, - configurable: true - }); + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); } -} -},{"util":106}],77:[function(require,module,exports){ -(function (process){ -'use strict'; + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; -} + alias = state.input.slice(_position, state.position); -function nextTick(fn) { - var args = new Array(arguments.length - 1); - var i = 0; - while (i < args.length) { - args[i++] = arguments[i]; + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); } - process.nextTick(function afterTick() { - fn.apply(null, args); - }); + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; } -}).call(this,require('_process')) +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } } - var timeout = setTimeout(cleanUpNextTick); - draining = true; + } - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - clearTimeout(timeout); -} + if (1 === indentStatus) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; } + } else { + allowBlockCollections = false; + } } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - setTimeout(drainQueue, 0); + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; } -}; -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; + blockIndent = state.position - state.lineStart; -function noop() {} + if (1 === indentStatus) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; + } else if (readAlias(state)) { + hasContent = true; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + if (null !== state.tag || null !== state.anchor) { + throwError(state, 'alias node should not have any properties'); + } -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; -},{}],79:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { + if (null === state.tag) { + state.tag = '?'; + } + } - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (0 === indentStatus) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, + if (null !== state.tag && '!' !== state.tag) { + if ('?' === state.tag) { + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; + typeIndex < typeQuantity; + typeIndex += 1) { + type = state.implicitTypes[typeIndex]; - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only assigned to plain scalars. So, it isn't + // needed to check for 'kind' conformity. - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap, state.tag)) { + type = state.typeMap[state.tag]; - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + if (null !== state.result && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, + return null !== state.tag || null !== state.anchor || hasContent; +} - /** Temporary variable */ - key; +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; - /*--------------------------------------------------------------------------*/ + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } + while (0 !== (ch = state.input.charCodeAt(state.position))) { + skipSeparationSpace(state, true, -1); - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } + ch = state.input.charCodeAt(state.position); - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } + if (state.lineIndent > 0 || 0x25/* % */ !== ch) { + break; + } - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } + while (0 !== ch && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } + while (0 !== ch) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; + if (0x23/* # */ === ch) { + do { ch = state.input.charCodeAt(++state.position); } + while (0 !== ch && !is_EOL(ch)); + break; + } - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. + if (is_EOL(ch)) { + break; + } - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } + _position = state.position; - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } + while (0 !== ch && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. + directiveArgs.push(state.input.slice(_position, state.position)); + } - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + if (0 !== ch) { + readLineBreak(state); + } - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } - if (index >= inputLength) { - error('invalid-input'); - } + skipSeparationSpace(state, true, -1); - digit = basicToDigit(input.charCodeAt(index++)); + if (0 === state.lineIndent && + 0x2D/* - */ === state.input.charCodeAt(state.position) && + 0x2D/* - */ === state.input.charCodeAt(state.position + 1) && + 0x2D/* - */ === state.input.charCodeAt(state.position + 2)) { + state.position += 3; + skipSeparationSpace(state, true, -1); - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); - if (digit < t) { - break; - } + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } + state.documents.push(state.result); - w *= baseMinusT; + if (state.position === state.lineStart && testDocumentSeparator(state)) { - } + if (0x2E/* . */ === state.input.charCodeAt(state.position)) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - n += floor(i / out); - i %= out; +function loadDocuments(input, options) { + input = String(input); + options = options || {}; - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); + if (input.length !== 0) { - } + // Add tailing `\n` if not exists + if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) && + 0x0D/* CR */ !== input.charCodeAt(input.length - 1)) { + input += '\n'; + } - return ucs2encode(output); - } + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; + var state = new State(input, options); - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; - // Cache the length - inputLength = input.length; + while (0x20/* Space */ === state.input.charCodeAt(state.position)) { + state.lineIndent += 1; + state.position += 1; + } - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; + while (state.position < (state.length - 1)) { + readDocument(state); + } - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } + return state.documents; +} - handledCPCount = basicLength = output.length; - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. +function loadAll(input, iterator, options) { + var documents = loadDocuments(input, options), index, length; - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } + for (index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} - // Main encoding loop: - while (handledCPCount < inputLength) { - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } +function load(input, options) { + var documents = loadDocuments(input, options); - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } + if (0 === documents.length) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (1 === documents.length) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} - delta += (m - n) * handledCPCountPlusOne; - n = m; - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; +function safeLoadAll(input, output, options) { + loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - ++delta; - ++n; +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; - } - return output.join(''); - } +},{"./common":29,"./exception":31,"./mark":33,"./schema/default_full":36,"./schema/default_safe":37}],33:[function(require,module,exports){ +'use strict'; - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } +var common = require('./common'); - /*--------------------------------------------------------------------------*/ - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } -}(this)); +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + if (!this.buffer) { + return null; + } -},{}],80:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. + indent = indent || 4; + maxLength = maxLength || 75; -'use strict'; + head = ''; + start = this.position; -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} + while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; + tail = ''; + end = this.position; - if (typeof qs !== 'string' || qs.length === 0) { - return obj; + while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } } - var regexp = /\+/g; - qs = qs.split(sep); + snippet = this.buffer.slice(start, end); - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } + if (this.name) { + where += 'in "' + this.name + '" '; + } - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; } } - return obj; + return where; }; -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; -},{}],81:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +module.exports = Mark; +},{"./common":29}],34:[function(require,module,exports){ 'use strict'; -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; +/*eslint-disable max-len*/ - case 'boolean': - return v ? 'true' : 'false'; +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); - case 'number': - return isFinite(v) ? v : ''; - default: - return ''; - } -}; +function compileList(schema, name, result) { + var exclude = []; -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag) { + exclude.push(previousIndex); } - }).join(sep); + }); - } + result.push(currentType); + }); - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; + return result.filter(function (type, index) { + return -1 === exclude.indexOf(index); + }); +} -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); +function compileMap(/* lists... */) { + var result = {}, index, length; + + function collectType(type) { + result[type.tag] = type; } - return res; -} -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); } - return res; -}; -},{}],82:[function(require,module,exports){ -'use strict'; + return result; +} -exports.decode = exports.parse = require('./decode'); -exports.encode = exports.stringify = require('./encode'); -},{"./decode":80,"./encode":81}],83:[function(require,module,exports){ -module.exports = require("./lib/_stream_duplex.js") +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; -},{"./lib/_stream_duplex.js":84}],84:[function(require,module,exports){ -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. + this.implicit.forEach(function (type) { + if (type.loadKind && 'scalar' !== type.loadKind) { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); -'use strict'; + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ +Schema.DEFAULT = null; -module.exports = Duplex; -/**/ -var processNextTick = require('process-nextick-args'); -/**/ +Schema.create = function createSchema() { + var schemas, types; -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; -util.inherits(Duplex, Readable); + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; -} + schemas = common.toArray(schemas); + types = common.toArray(types); -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } - Readable.call(this, options); - Writable.call(this, options); + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; - if (options && options.readable === false) this.readable = false; - if (options && options.writable === false) this.writable = false; +module.exports = Schema; - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; +},{"./common":29,"./exception":31,"./type":40}],35:[function(require,module,exports){ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. - this.once('end', onend); -} -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; +'use strict'; - // no more data can be written. - // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); -} -function onEndNT(self) { - self.end(); -} +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); + +},{"../schema":34,"./json":39}],36:[function(require,module,exports){ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} -},{"./_stream_readable":86,"./_stream_writable":88,"core-util-is":13,"inherits":20,"process-nextick-args":77}],85:[function(require,module,exports){ -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. 'use strict'; -module.exports = PassThrough; -var Transform = require('./_stream_transform'); +var Schema = require('../schema'); -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ -util.inherits(PassThrough, Transform); +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); +},{"../schema":34,"../type/js/function":45,"../type/js/regexp":46,"../type/js/undefined":47,"./default_safe":37}],37:[function(require,module,exports){ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) - Transform.call(this, options); -} -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":87,"core-util-is":13,"inherits":20}],86:[function(require,module,exports){ -(function (process){ 'use strict'; -module.exports = Readable; -/**/ -var processNextTick = require('process-nextick-args'); -/**/ +var Schema = require('../schema'); -/**/ -var isArray = require('isarray'); -/**/ -/**/ -var Buffer = require('buffer').Buffer; -/**/ +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); -Readable.ReadableState = ReadableState; +},{"../schema":34,"../type/binary":41,"../type/merge":49,"../type/omap":51,"../type/pairs":52,"../type/set":54,"../type/timestamp":56,"./core":35}],38:[function(require,module,exports){ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 -var EE = require('events'); -/**/ -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ +'use strict'; -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; - } -})(); -/**/ -var Buffer = require('buffer').Buffer; +var Schema = require('../schema'); -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ -/**/ -var debugUtil = require('util'); -var debug = undefined; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); -var StringDecoder; +},{"../schema":34,"../type/map":48,"../type/seq":53,"../type/str":55}],39:[function(require,module,exports){ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. -util.inherits(Readable, Stream); -var Duplex; -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); +'use strict'; - options = options || {}; - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; +var Schema = require('../schema'); - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; +},{"../schema":34,"../type/bool":42,"../type/float":43,"../type/int":44,"../type/null":50,"./failsafe":38}],40:[function(require,module,exports){ +'use strict'; - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; +var YAMLException = require('./exception'); - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; +function compileStyleAliases(map) { + var result = {}; - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; + if (null !== map) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; + return result; +} - // if true, a maybeReadMore has been scheduled - this.readingMore = false; +function Type(tag, options) { + options = options || {}; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; + Object.keys(options).forEach(function (name) { + if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); } } -var Duplex; -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); +module.exports = Type; - if (!(this instanceof Readable)) return new Readable(options); +},{"./exception":31}],41:[function(require,module,exports){ +'use strict'; - this._readableState = new ReadableState(options, this); +/*eslint-disable no-bitwise*/ - // legacy - this.readable = true; +// A trick for browserified version. +// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined +var NodeBuffer = require('buffer').Buffer; +var Type = require('../type'); - if (options && typeof options.read === 'function') this._read = options.read; - Stream.call(this); -} +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - if (!state.objectMode && typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } +function resolveYamlBinary(data) { + if (null === data) { + return false; } - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - var skipAdd; - if (state.decoder && !addToFront && !encoding) { - chunk = state.decoder.write(chunk); - skipAdd = !state.objectMode && chunk.length === 0; - } + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - if (!addToFront) state.reading = false; + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); - // Don't add to the buffer if we've decoded to an empty string chunk and - // we're not in object mode - if (!skipAdd) { - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + // Skip CR/LF + if (code > 64) { continue; } - if (state.needReadable) emitReadable(stream); - } - } + // Fail on illegal characters + if (code < 0) { return false; } - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; + bitlen += 6; } - return needMoreData(state); -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; } -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) return 0; + // Collect by 6*4 bits (3 bytes) - if (state.objectMode) return n === 0 ? 0 : 1; + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } - if (n === null || isNaN(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length; + bits = (bits << 6) | map.indexOf(input.charAt(idx)); } - if (n <= 0) return 0; + // Dump tail - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + tailbits = (max % 4) * 6; - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else { - return state.length; - } - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (typeof n !== 'number' || n > 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); } - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + return new NodeBuffer(result); } - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. + return result; +} - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } + // Convert every three bytes to 4 ASCII characters. - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; + bits = (bits << 8) + object[idx]; } - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) n = howMuchToRead(nOrig, state); + // Dump tail - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; + tail = max % 3; - if (ret === null) { - state.needReadable = true; - n = 0; + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; } - state.length -= n; + return result; +} - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) state.needReadable = true; +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) endReadable(this); +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); - if (ret !== null) this.emit('data', ret); +},{"../type":40,"buffer":8}],42:[function(require,module,exports){ +'use strict'; - return ret; -}; +var Type = require('../type'); -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); +function resolveYamlBoolean(data) { + if (null === data) { + return false; } - return er; -} -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; + var max = data.length; - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); } -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); - } +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; } -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); +function isBoolean(object) { + return '[object Boolean]' === Object.prototype.toString.call(object); } -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":40}],43:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' + + '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' + + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + '|[-+]?\\.(?:inf|Inf|INF)' + + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (null === data) { + return false; } -} -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; + if (!YAML_FLOAT_PATTERN.test(data)) { + return false; } - state.readingMore = false; + return true; } -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('not implemented')); -}; +function constructYamlFloat(data) { + var value, sign, base, digits; -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; + value = data.replace(/_/g, '').toLowerCase(); + sign = '-' === value[0] ? -1 : 1; + digits = []; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; + if (0 <= '+-'.indexOf(value[0])) { + value = value.slice(1); } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + if ('.inf' === value) { + return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + } else if ('.nan' === value) { + return NaN; - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } + } else if (0 <= value.indexOf(':')) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); + value = 0.0; + base = 1; - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); - cleanedUp = true; + return sign * value; - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } + return sign * parseFloat(value, 10); +} - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - } - src.pause(); - } - } - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error]; +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); +function representYamlFloat(object, style) { + var res; - function unpipe() { - debug('unpipe'); - src.unpipe(dest); + if (isNaN(object)) { + switch (style) { + case 'lowercase': + return '.nan'; + case 'uppercase': + return '.NAN'; + case 'camelcase': + return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': + return '.inf'; + case 'uppercase': + return '.INF'; + case 'camelcase': + return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': + return '-.inf'; + case 'uppercase': + return '-.INF'; + case 'camelcase': + return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; } - // tell the dest that it's being piped to - dest.emit('pipe', src); + res = object.toString(10); - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack - return dest; -}; + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; +function isFloat(object) { + return ('[object Number]' === Object.prototype.toString.call(object)) && + (0 !== object % 1 || common.isNegativeZero(object)); } -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; +},{"../common":29,"../type":40}],44:[function(require,module,exports){ +'use strict'; - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; +var common = require('../common'); +var Type = require('../type'); - if (!dest) dest = state.pipes; +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this); - return this; +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (null === data) { + return false; } - // slow case. multiple pipe destinations. + var max = data.length, + index = 0, + hasDigits = false, + ch; - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; + if (!max) { return false; } + + ch = data[index]; - for (var _i = 0; _i < len; _i++) { - dests[_i].emit('unpipe', this); - }return this; + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; } - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) return this; + if (ch === '0') { + // 0 + if (index + 1 === max) { return true; } + ch = data[++index]; - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; + // base 2, base 8, base 16 - dest.emit('unpipe', this); + if (ch === 'b') { + // base 2 + index++; - return this; -}; + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (ch !== '0' && ch !== '1') { + return false; + } + hasDigits = true; + } + return hasDigits; + } -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } + if (ch === 'x') { + // base 16 + index++; - if (ev === 'readable' && !this._readableState.endEmitted) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - processNextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this, state); + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (!isHexCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; } + return hasDigits; } - } - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (!isOctCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + return hasDigits; + } -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} + // base 10 (except 0) or base 60 -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (ch === ':') { break; } + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; } - return this; -}; -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - processNextTick(resume_, stream, state); - } -} + if (!hasDigits) { return false; } -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } + // if !base60 - done; + if (ch !== ':') { return true; } - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); } -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); } - return this; -}; -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') { sign = -1; } + value = value.slice(1); + ch = value[0]; } -} -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var state = this._readableState; - var paused = false; + if ('0' === value) { + return 0; + } - var self = this; - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) self.push(chunk); + if (ch === '0') { + if (value[1] === 'b') { + return sign * parseInt(value.slice(2), 2); + } + if (value[1] === 'x') { + return sign * parseInt(value, 16); } + return sign * parseInt(value, 8); - self.push(null); - }); + } - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + value = 0; + base = 1; - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } + return sign * value; - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function (ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); + } - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; + return sign * parseInt(value, 10); +} - return self; -}; +function isInteger(object) { + return ('[object Number]' === Object.prototype.toString.call(object)) && + (0 === object % 1 && !common.isNegativeZero(object)); +} -// exposed for testing purposes only. -Readable._fromList = fromList; +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (object) { return '0b' + object.toString(2); }, + octal: function (object) { return '0' + object.toString(8); }, + decimal: function (object) { return object.toString(10); }, + hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; +},{"../common":29,"../type":40}],45:[function(require,module,exports){ +'use strict'; - // nothing in the list, definitely empty. - if (list.length === 0) return null; +var esprima; - if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) ret = '';else ret = new Buffer(n); +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + esprima = require('esprima'); +} catch (_) { + /*global window */ + if (typeof window !== 'undefined') { esprima = window.esprima; } +} - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); +var Type = require('../../type'); - if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy); +function resolveJavascriptFunction(data) { + if (null === data) { + return false; + } - if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift(); + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); - c += cpy; - } + if ('Program' !== ast.type || + 1 !== ast.body.length || + 'ExpressionStatement' !== ast.body[0].type || + 'FunctionExpression' !== ast.body[0].expression.type) { + return false; } - } - return ret; + return true; + } catch (err) { + return false; + } } -function endReadable(stream) { - var state = stream._readableState; +function constructJavascriptFunction(data) { + /*jslint evil:true*/ - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('endReadable called on non-empty stream'); + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; - if (!state.endEmitted) { - state.ended = true; - processNextTick(endReadableNT, state, stream); + if ('Program' !== ast.type || + 1 !== ast.body.length || + 'ExpressionStatement' !== ast.body[0].type || + 'FunctionExpression' !== ast.body[0].expression.type) { + throw new Error('Failed to resolve function'); } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); } -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } +function representJavascriptFunction(object /*, style*/) { + return object.toString(); } -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } +function isFunction(object) { + return '[object Function]' === Object.prototype.toString.call(object); } -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + +},{"../../type":40,"esprima":18}],46:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (null === data) { + return false; } - return -1; -} -}).call(this,require('_process')) -},{"./_stream_duplex":84,"_process":78,"buffer":10,"core-util-is":13,"events":17,"inherits":20,"isarray":22,"process-nextick-args":77,"string_decoder/":98,"util":8}],87:[function(require,module,exports){ -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; + if (0 === data.length) { + return false; + } -var Duplex = require('./_stream_duplex'); + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if ('/' === regexp[0]) { + if (tail) { + modifiers = tail[1]; + } -util.inherits(Transform, Duplex); + if (modifiers.length > 3) { return false; } + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; } -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; + try { + return true; + } catch (error) { + return false; + } } -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; - var cb = ts.writecb; + // `/foo/gim` - tail can be maximum 4 chars + if ('/' === regexp[0]) { + if (tail) { + modifiers = tail[1]; + } + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } - if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + return new RegExp(regexp, modifiers); +} - ts.writechunk = null; - ts.writecb = null; +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; - if (data !== null && data !== undefined) stream.push(data); + if (object.global) { + result += 'g'; + } - cb(er); + if (object.multiline) { + result += 'm'; + } - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + if (object.ignoreCase) { + result += 'i'; } -} -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); + return result; +} - Duplex.call(this, options); +function isRegExp(object) { + return '[object RegExp]' === Object.prototype.toString.call(object); +} - this._transformState = new TransformState(this); +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); - // when the writable side finishes, then flush out anything remaining. - var stream = this; +},{"../../type":40}],47:[function(require,module,exports){ +'use strict'; - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; +var Type = require('../../type'); - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; +function resolveJavascriptUndefined() { + return true; +} - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} - if (typeof options.flush === 'function') this._flush = options.flush; - } +function representJavascriptUndefined() { + return ''; +} - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er) { - done(stream, er); - });else done(stream); - }); +function isUndefined(object) { + return 'undefined' === typeof object; } -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('not implemented'); -}; +},{"../../type":40}],48:[function(require,module,exports){ +'use strict'; -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; +var Type = require('../type'); -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return null !== data ? data : {}; } +}); - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; +},{"../type":40}],49:[function(require,module,exports){ +'use strict'; -function done(stream, er) { - if (er) return stream.emit('error', er); +var Type = require('../type'); - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; +function resolveYamlMerge(data) { + return '<<' === data || null === data; +} - if (ws.length) throw new Error('calling transform done when ws.length != 0'); +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); - if (ts.transforming) throw new Error('calling transform done when still transforming'); +},{"../type":40}],50:[function(require,module,exports){ +'use strict'; - return stream.push(null); -} -},{"./_stream_duplex":84,"core-util-is":13,"inherits":20}],88:[function(require,module,exports){ -(function (process){ -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. +var Type = require('../type'); -'use strict'; +function resolveYamlNull(data) { + if (null === data) { + return true; + } -module.exports = Writable; + var max = data.length; -/**/ -var processNextTick = require('process-nextick-args'); -/**/ + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; -/**/ +function constructYamlNull() { + return null; +} -/**/ -var Buffer = require('buffer').Buffer; -/**/ +function isNull(object) { + return null === object; +} -Writable.WritableState = WritableState; +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +},{"../type":40}],51:[function(require,module,exports){ +'use strict'; -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ +var Type = require('../type'); -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (null === data) { + return true; } -})(); -/**/ -var Buffer = require('buffer').Buffer; + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; -util.inherits(Writable, Stream); + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; -function nop() {} + if ('[object Object]' !== _toString.call(pair)) { + return false; + } -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) { + pairHasKey = true; + } else { + return false; + } + } + } -var Duplex; -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); + if (!pairHasKey) { + return false; + } - options = options || {}; + if (-1 === objectKeys.indexOf(pairKey)) { + objectKeys.push(pairKey); + } else { + return false; + } + } - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; + return true; +} - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; +function constructYamlOmap(data) { + return null !== data ? data : []; +} - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; +},{"../type":40}],52:[function(require,module,exports){ +'use strict'; - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; +var Type = require('../type'); - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; +var _toString = Object.prototype.toString; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; +function resolveYamlPairs(data) { + if (null === data) { + return true; + } - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; + var index, length, pair, keys, result, + object = data; - // a flag to see when we're in the middle of a write. - this.writing = false; + result = new Array(object.length); - // when true all writes will be buffered until .uncork() call - this.corked = 0; + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; + if ('[object Object]' !== _toString.call(pair)) { + return false; + } - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; + keys = Object.keys(pair); - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; + if (1 !== keys.length) { + return false; + } - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; + result[index] = [ keys[0], pair[keys[0]] ]; + } - // the amount that is being written when _write is called. - this.writelen = 0; + return true; +} - this.bufferedRequest = null; - this.lastBufferedRequest = null; +function constructYamlPairs(data) { + if (null === data) { + return []; + } - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; + var index, length, pair, keys, result, + object = data; - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; + result = new Array(object.length); - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); - // count buffered requests - this.bufferedRequestCount = 0; + result[index] = [ keys[0], pair[keys[0]] ]; + } - // create the two objects needed to store the corked requests - // they are not a linked list, as no new elements are inserted in there - this.corkedRequestsFree = new CorkedRequest(this); - this.corkedRequestsFree.next = new CorkedRequest(this); + return result; } -WritableState.prototype.getBuffer = function writableStateGetBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') - }); - } catch (_) {} -})(); +},{"../type":40}],53:[function(require,module,exports){ +'use strict'; -var Duplex; -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); +var Type = require('../type'); - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return null !== data ? data : []; } +}); - this._writableState = new WritableState(options, this); +},{"../type":40}],54:[function(require,module,exports){ +'use strict'; - // legacy. - this.writable = true; +var Type = require('../type'); - if (options) { - if (typeof options.write === 'function') this._write = options.write; +var _hasOwnProperty = Object.prototype.hasOwnProperty; - if (typeof options.writev === 'function') this._writev = options.writev; +function resolveYamlSet(data) { + if (null === data) { + return true; } - Stream.call(this); -} + var key, object = data; -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (null !== object[key]) { + return false; + } + } + } -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - processNextTick(cb, er); + return true; } -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - processNextTick(cb, er); - valid = false; - } - return valid; +function constructYamlSet(data) { + return null !== data ? data : {}; } -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); - if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } +},{"../type":40}],55:[function(require,module,exports){ +'use strict'; - return ret; -}; +var Type = require('../type'); -Writable.prototype.cork = function () { - var state = this._writableState; +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return null !== data ? data : ''; } +}); - state.corked++; -}; +},{"../type":40}],56:[function(require,module,exports){ +'use strict'; -Writable.prototype.uncork = function () { - var state = this._writableState; +var Type = require('../type'); - if (state.corked) { - state.corked--; +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); +function resolveYamlTimestamp(data) { + if (null === data) { + return false; } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; -}; -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = new Buffer(chunk, encoding); + if (YAML_TIMESTAMP_REGEXP.exec(data) === null) { + return false; } - return chunk; + + return true; } -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; + match = YAML_TIMESTAMP_REGEXP.exec(data); - state.length += len; + if (null === match) { + throw new Error('Date resolve error'); + } - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; + // match: [1] year [2] month [3] day - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); + fraction = +fraction; } - return ret; -} + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if ('-' === match[9]) { + delta = -delta; + } + } -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) processNextTick(cb, er);else cb(er); + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - stream._writableState.errorEmitted = true; - stream.emit('error', er); + if (delta) { + date.setTime(date.getTime() - delta); + } + + return date; } -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); } -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); - onwriteStateUpdate(state); +},{"../type":40}],57:[function(require,module,exports){ +/** ! + * JSON Schema $Ref Parser v1.4.1 + * + * @link https://github.com/BigstickCarpet/json-schema-ref-parser + * @license MIT + */ +'use strict'; - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); +var $Ref = require('./ref'), + Pointer = require('./pointer'), + util = require('./util'), + url = require('url'); - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } +module.exports = bundle; - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} +/** + * Bundles all external JSON references into the main JSON schema, thus resulting in a schema that + * only has *internal* references, not any *external* references. + * This method mutates the JSON schema object, adding new references and re-mapping existing ones. + * + * @param {$RefParser} parser + * @param {$RefParserOptions} options + */ +function bundle(parser, options) { + util.debug('Bundling $ref pointers in %s', parser._basePath); -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); + remap(parser.$refs, options); + dereference(parser._basePath, parser.$refs, options); } -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); +/** + * Re-maps all $ref pointers in the schema, so that they are relative to the root of the schema. + * + * @param {$Refs} $refs + * @param {$RefParserOptions} options + */ +function remap($refs, options) { + var remapped = []; + + // Crawl the schema and determine the re-mapped values for all $ref pointers. + // NOTE: We don't actually APPLY the re-mappings them yet, since that can affect other re-mappings + Object.keys($refs._$refs).forEach(function(key) { + var $ref = $refs._$refs[key]; + crawl($ref.value, $ref.path + '#', $refs, remapped, options); + }); + + // Now APPLY all of the re-mappings + for (var i = 0; i < remapped.length; i++) { + var mapping = remapped[i]; + mapping.old$Ref.$ref = mapping.new$Ref.$ref; } } -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; +/** + * Recursively crawls the given value, and re-maps any JSON references. + * + * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. + * @param {string} path - The path to use for resolving relative JSON references + * @param {$Refs} $refs - The resolved JSON references + * @param {object[]} remapped - An array of the re-mapped JSON references + * @param {$RefParserOptions} options + */ +function crawl(obj, path, $refs, remapped, options) { + if (obj && typeof obj === 'object') { + Object.keys(obj).forEach(function(key) { + var keyPath = Pointer.join(path, key); + var value = obj[key]; + + if ($Ref.is$Ref(value)) { + // We found a $ref, so resolve it + util.debug('Re-mapping $ref pointer "%s" at %s', value.$ref, keyPath); + var $refPath = url.resolve(path, value.$ref); + var pointer = $refs._resolve($refPath, options); + + // Re-map the value + var new$RefPath = pointer.$ref.pathFromRoot + util.path.getHash(pointer.path).substr(1); + util.debug(' new value: %s', new$RefPath); + remapped.push({ + old$Ref: value, + new$Ref: {$ref: new$RefPath} // Note: DON'T name this property `new` (https://github.com/BigstickCarpet/json-schema-ref-parser/issues/3) + }); + } + else { + crawl(value, keyPath, $refs, remapped, options); + } + }); + } +} - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; +/** + * Dereferences each external $ref pointer exactly ONCE. + * + * @param {string} basePath + * @param {$Refs} $refs + * @param {$RefParserOptions} options + */ +function dereference(basePath, $refs, options) { + basePath = util.path.stripHash(basePath); - var count = 0; - while (entry) { - buffer[count] = entry; - entry = entry.next; - count += 1; + Object.keys($refs._$refs).forEach(function(key) { + var $ref = $refs._$refs[key]; + if ($ref.pathFromRoot !== '#') { + $refs.set(basePath + $ref.pathFromRoot, $ref.value, options); } + }); +} - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; +},{"./pointer":62,"./ref":65,"./util":68,"url":100}],58:[function(require,module,exports){ +'use strict'; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } +var $Ref = require('./ref'), + Pointer = require('./pointer'), + util = require('./util'), + ono = require('ono'), + url = require('url'); - if (entry === null) state.lastBufferedRequest = null; - } +module.exports = dereference; - state.bufferedRequestCount = 0; - state.bufferedRequest = entry; - state.bufferProcessing = false; +/** + * Crawls the JSON schema, finds all JSON references, and dereferences them. + * This method mutates the JSON schema object, replacing JSON references with their resolved value. + * + * @param {$RefParser} parser + * @param {$RefParserOptions} options + */ +function dereference(parser, options) { + util.debug('Dereferencing $ref pointers in %s', parser._basePath); + parser.$refs.circular = false; + crawl(parser.schema, parser._basePath, [], parser.$refs, options); } -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('not implemented')); -}; - -Writable.prototype._writev = null; +/** + * Recursively crawls the given value, and dereferences any JSON references. + * + * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. + * @param {string} path - The path to use for resolving relative JSON references + * @param {object[]} parents - An array of the parent objects that have already been dereferenced + * @param {$Refs} $refs - The resolved JSON references + * @param {$RefParserOptions} options + * @returns {boolean} - Returns true if a circular reference was found + */ +function crawl(obj, path, parents, $refs, options) { + var isCircular = false; -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; + if (obj && typeof obj === 'object') { + parents.push(obj); - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } + Object.keys(obj).forEach(function(key) { + var keyPath = Pointer.join(path, key); + var value = obj[key]; + var circular = false; - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + if ($Ref.isAllowed$Ref(value, options)) { + // We found a $ref, so resolve it + util.debug('Dereferencing $ref pointer "%s" at %s', value.$ref, keyPath); + var $refPath = url.resolve(path, value.$ref); + var pointer = $refs._resolve($refPath, options); - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } + // Check for circular references + circular = pointer.circular || parents.indexOf(pointer.value) !== -1; + circular && foundCircularReference(keyPath, $refs, options); - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; + // Dereference the JSON reference + var dereferencedValue = getDereferencedValue(value, pointer.value); -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} + // Crawl the dereferenced value (unless it's circular) + if (!circular) { + // If the `crawl` method returns true, then dereferenced value is circular + circular = crawl(dereferencedValue, pointer.path, parents, $refs, options); + } -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } -} + // Replace the JSON reference with the dereferenced value + if (!circular || options.$refs.circular === true) { + obj[key] = dereferencedValue; + } + } + else { + if (parents.indexOf(value) === -1) { + circular = crawl(value, keyPath, parents, $refs, options); + } + else { + circular = foundCircularReference(keyPath, $refs, options); + } + } -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else { - prefinish(stream, state); - } - } - return need; -} + // Set the "isCircular" flag if this or any other property is circular + isCircular = isCircular || circular; + }); -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); + parents.pop(); } - state.ended = true; - stream.writable = false; + return isCircular; } -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function (err) { - var entry = _this.entry; - _this.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = _this; - } else { - state.corkedRequestsFree = _this; - } - }; -} -}).call(this,require('_process')) - -},{"./_stream_duplex":84,"_process":78,"buffer":10,"core-util-is":13,"events":17,"inherits":20,"process-nextick-args":77,"util-deprecate":104}],89:[function(require,module,exports){ -module.exports = require("./lib/_stream_passthrough.js") - -},{"./lib/_stream_passthrough.js":85}],90:[function(require,module,exports){ -var Stream = (function (){ - try { - return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify - } catch(_){} -}()); -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = Stream || exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -},{"./lib/_stream_duplex.js":84,"./lib/_stream_passthrough.js":85,"./lib/_stream_readable.js":86,"./lib/_stream_transform.js":87,"./lib/_stream_writable.js":88}],91:[function(require,module,exports){ -module.exports = require("./lib/_stream_transform.js") - -},{"./lib/_stream_transform.js":87}],92:[function(require,module,exports){ -module.exports = require("./lib/_stream_writable.js") - -},{"./lib/_stream_writable.js":88}],93:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); +/** + * Returns the dereferenced value of the given JSON reference. + * + * @param {object} currentValue - the current value, which contains a JSON reference ("$ref" property) + * @param {*} resolvedValue - the resolved value, which can be any type + * @returns {*} - Returns the dereferenced value + */ +function getDereferencedValue(currentValue, resolvedValue) { + if (resolvedValue && typeof resolvedValue === 'object' && Object.keys(currentValue).length > 1) { + // The current value has additional properties (other than "$ref"), + // so merge the resolved value rather than completely replacing the reference + var merged = {}; + Object.keys(currentValue).forEach(function(key) { + if (key !== '$ref') { + merged[key] = currentValue[key]; } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } + }); + Object.keys(resolvedValue).forEach(function(key) { + if (!(key in merged)) { + merged[key] = resolvedValue[key]; + } + }); + return merged; } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); + else { + // Completely replace the original reference with the resolved value + return resolvedValue; } +} - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); +/** + * Called when a circular reference is found. + * It sets the {@link $Refs#circular} flag, and throws an error if options.$refs.circular is false. + * + * @param {string} keyPath - The JSON Reference path of the circular reference + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * @returns {boolean} - always returns true, to indicate that a circular reference was found + */ +function foundCircularReference(keyPath, $refs, options) { + $refs.circular = true; + if (!options.$refs.circular) { + throw ono.reference('Circular $ref pointer found at %s', keyPath); } + return true; +} +},{"./pointer":62,"./ref":65,"./util":68,"ono":75,"url":100}],59:[function(require,module,exports){ +(function (Buffer){ +'use strict'; - function onclose() { - if (didOnEnd) return; - didOnEnd = true; +var Promise = require('./promise'), + Options = require('./options'), + $Refs = require('./refs'), + $Ref = require('./ref'), + read = require('./read'), + resolve = require('./resolve'), + bundle = require('./bundle'), + dereference = require('./dereference'), + util = require('./util'), + url = require('url'), + maybe = require('call-me-maybe'), + ono = require('ono'); - if (typeof dest.destroy === 'function') dest.destroy(); - } +module.exports = $RefParser; +module.exports.YAML = require('./yaml'); - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } +/** + * This class parses a JSON schema, builds a map of its JSON references and their resolved values, + * and provides methods for traversing, manipulating, and dereferencing those references. + * + * @constructor + */ +function $RefParser() { + /** + * The parsed (and possibly dereferenced) JSON schema object + * + * @type {object} + * @readonly + */ + this.schema = null; - source.on('error', onerror); - dest.on('error', onerror); + /** + * The resolved JSON references + * + * @type {$Refs} + */ + this.$refs = new $Refs(); - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); + /** + * The file path or URL of the main JSON schema file. + * This will be empty if the schema was passed as an object rather than a path. + * + * @type {string} + * @protected + */ + this._basePath = ''; +} - source.removeListener('end', onend); - source.removeListener('close', onclose); +/** + * Parses the given JSON schema. + * This method does not resolve any JSON references. + * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed + * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object. + * @returns {Promise} - The returned promise resolves with the parsed JSON schema object. + */ +$RefParser.parse = function(schema, options, callback) { + var Class = this; // eslint-disable-line consistent-this + return new Class().parse(schema, options, callback); +}; - source.removeListener('error', onerror); - dest.removeListener('error', onerror); +/** + * Parses the given JSON schema. + * This method does not resolve any JSON references. + * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed + * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object. + * @returns {Promise} - The returned promise resolves with the parsed JSON schema object. + */ +$RefParser.prototype.parse = function(schema, options, callback) { + var args = normalizeArgs(arguments); - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); + if (args.schema && typeof args.schema === 'object') { + // The schema is an object, not a path/url + this.schema = args.schema; + this._basePath = ''; + var $ref = new $Ref(this.$refs, this._basePath); + $ref.setValue(this.schema, args.options); - dest.removeListener('close', cleanup); + return maybe(args.callback, Promise.resolve(this.schema)); } - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); + if (!args.schema || typeof args.schema !== 'string') { + var err = ono('Expected a file path, URL, or object. Got %s', args.schema); + return maybe(args.callback, Promise.reject(err)); + } - dest.emit('pipe', source); + var me = this; - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; + // Resolve the absolute path of the schema + args.schema = util.path.localPathToUrl(args.schema); + args.schema = url.resolve(util.path.cwd(), args.schema); + this._basePath = util.path.stripHash(args.schema); + + // Read the schema file/url + return read(args.schema, this.$refs, args.options) + .then(function(cached$Ref) { + var value = cached$Ref.$ref.value; + if (!value || typeof value !== 'object' || value instanceof Buffer) { + throw ono.syntax('"%s" is not a valid JSON Schema', me._basePath); + } + else { + me.schema = value; + return maybe(args.callback, Promise.resolve(me.schema)); + } + }) + .catch(function(e) { + return maybe(args.callback, Promise.reject(e)); + }); }; -},{"events":17,"inherits":20,"readable-stream/duplex.js":83,"readable-stream/passthrough.js":89,"readable-stream/readable.js":90,"readable-stream/transform.js":91,"readable-stream/writable.js":92}],94:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') +/** + * Parses the given JSON schema and resolves any JSON references, including references in + * externally-referenced files. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved + * @param {function} [callback] + * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references + * + * @returns {Promise} + * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references + */ +$RefParser.resolve = function(schema, options, callback) { + var Class = this; // eslint-disable-line consistent-this + return new Class().resolve(schema, options, callback); +}; -var http = exports +/** + * Parses the given JSON schema and resolves any JSON references, including references in + * externally-referenced files. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved + * @param {function} [callback] + * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references + * + * @returns {Promise} + * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references + */ +$RefParser.prototype.resolve = function(schema, options, callback) { + var me = this; + var args = normalizeArgs(arguments); -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) + return this.parse(args.schema, args.options) + .then(function() { + return resolve(me, args.options); + }) + .then(function() { + return maybe(args.callback, Promise.resolve(me.$refs)); + }) + .catch(function(err) { + return maybe(args.callback, Promise.reject(err)); + }); +}; - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' +/** + * Parses the given JSON schema, resolves any JSON references, and bundles all external references + * into the main JSON schema. This produces a JSON schema that only has *internal* references, + * not any *external* references. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object + * @returns {Promise} - The returned promise resolves with the bundled JSON schema object. + */ +$RefParser.bundle = function(schema, options, callback) { + var Class = this; // eslint-disable-line consistent-this + return new Class().bundle(schema, options, callback); +}; - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' +/** + * Parses the given JSON schema, resolves any JSON references, and bundles all external references + * into the main JSON schema. This produces a JSON schema that only has *internal* references, + * not any *external* references. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object + * @returns {Promise} - The returned promise resolves with the bundled JSON schema object. + */ +$RefParser.prototype.bundle = function(schema, options, callback) { + var me = this; + var args = normalizeArgs(arguments); - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' + return this.resolve(args.schema, args.options) + .then(function() { + bundle(me, args.options); + return maybe(args.callback, Promise.resolve(me.schema)); + }) + .catch(function(err) { + return maybe(args.callback, Promise.reject(err)); + }); +}; - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} +/** + * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema. + * That is, all JSON references are replaced with their resolved values. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object + * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object. + */ +$RefParser.dereference = function(schema, options, callback) { + var Class = this; // eslint-disable-line consistent-this + return new Class().dereference(schema, options, callback); +}; - // Also valid opts.auth, opts.mode +/** + * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema. + * That is, all JSON references are replaced with their resolved values. + * + * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object + * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object. + */ +$RefParser.prototype.dereference = function(schema, options, callback) { + var me = this; + var args = normalizeArgs(arguments); - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req -} + return this.resolve(args.schema, args.options) + .then(function() { + dereference(me, args.options); + return maybe(args.callback, Promise.resolve(me.schema)); + }) + .catch(function(err) { + return maybe(args.callback, Promise.reject(err)); + }); +}; -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req +/** + * Normalizes the given arguments, accounting for optional args. + * + * @param {Arguments} args + * @returns {object} + */ +function normalizeArgs(args) { + var options = args[1], callback = args[2]; + if (typeof options === 'function') { + callback = options; + options = undefined; + } + if (!(options instanceof Options)) { + options = new Options(options); + } + return { + schema: args[0], + options: options, + callback: callback + }; } -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.STATUS_CODES = statusCodes +}).call(this,require("buffer").Buffer) -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./bundle":57,"./dereference":58,"./options":60,"./promise":63,"./read":64,"./ref":65,"./refs":66,"./resolve":67,"./util":68,"./yaml":69,"buffer":10,"call-me-maybe":13,"ono":75,"url":100}],60:[function(require,module,exports){ +/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ +'use strict'; -},{"./lib/request":96,"builtin-status-codes":11,"url":102,"xtend":170}],95:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableByteStream) +module.exports = $RefParserOptions; -exports.blobConstructor = false -try { - new Blob([new ArrayBuffer(1)]) - exports.blobConstructor = true -} catch (e) {} +/** + * Options that determine how JSON schemas are parsed, dereferenced, and cached. + * + * @param {object|$RefParserOptions} [options] - Overridden options + * @constructor + */ +function $RefParserOptions(options) { + /** + * Determines what types of files can be parsed + */ + this.allow = { + /** + * Are JSON files allowed? + * If false, then all schemas must be in YAML format. + * @type {boolean} + */ + json: true, -var xhr = new global.XMLHttpRequest() -// If location.host is empty, e.g. if this page/worker was loaded -// from a Blob, then use example.com to avoid an error -xhr.open('GET', global.location.host ? '/' : 'https://example.com') + /** + * Are YAML files allowed? + * If false, then all schemas must be in JSON format. + * @type {boolean} + */ + yaml: true, -function checkTypeSupport (type) { - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false -} + /** + * Are zero-byte files allowed? + * If false, then an error will be thrown if a file is empty. + * @type {boolean} + */ + empty: true, -// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. -// Safari 7.1 appears to have fixed this bug. -var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' -var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) + /** + * Can unknown file types be $referenced? + * If true, then they will be parsed as Buffers (byte arrays). + * If false, then an error will be thrown. + * @type {boolean} + */ + unknown: true + }; -exports.arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer') -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && - checkTypeSupport('moz-chunked-arraybuffer') -exports.overrideMimeType = isFunction(xhr.overrideMimeType) -exports.vbArray = isFunction(global.VBArray) + /** + * Determines the types of JSON references that are allowed. + */ + this.$refs = { + /** + * Allow JSON references to other parts of the same file? + * @type {boolean} + */ + internal: true, -function isFunction (value) { - return typeof value === 'function' -} + /** + * Allow JSON references to external files/URLs? + * @type {boolean} + */ + external: true, -xhr = null // Help gc + /** + * Allow circular (recursive) JSON references? + * If false, then a {@link ReferenceError} will be thrown if a circular reference is found. + * If "ignore", then circular references will not be dereferenced. + * @type {boolean|string} + */ + circular: true + }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + /** + * How long to cache files (in seconds). + */ + this.cache = { + /** + * How long to cache local files, in seconds. + * @type {number} + */ + fs: 60, // 1 minute -},{}],96:[function(require,module,exports){ -(function (process,global,Buffer){ -// var Base64 = require('Base64') -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('stream') -var toArrayBuffer = require('to-arraybuffer') + /** + * How long to cache files downloaded via HTTP, in seconds. + * @type {number} + */ + http: 5 * 60, // 5 minutes -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates + /** + * How long to cache files downloaded via HTTPS, in seconds. + * @type {number} + */ + https: 5 * 60 // 5 minutes + }; -function decideMode (preferBinary) { - if (capability.fetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else if (capability.vbArray && preferBinary) { - return 'text:vbarray' - } else { - return 'text' - } + merge(options, this); } -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) +/** + * Fast, two-level object merge. + * + * @param {?object} src - The object to merge into dest + * @param {object} dest - The object to be modified + */ +function merge(src, dest) { + if (src) { + var topKeys = Object.keys(src); + for (var i = 0; i < topKeys.length; i++) { + var topKey = topKeys[i]; + var srcChild = src[topKey]; + if (dest[topKey] === undefined) { + dest[topKey] = srcChild; + } + else { + var childKeys = Object.keys(srcChild); + for (var j = 0; j < childKeys.length; j++) { + var childKey = childKeys[j]; + var srcChildValue = srcChild[childKey]; + if (srcChildValue !== undefined) { + dest[topKey][childKey] = srcChildValue; + } + } + } + } + } +} - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) +},{}],61:[function(require,module,exports){ +(function (Buffer){ +'use strict'; - var preferBinary - if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') - } - self._mode = decideMode(preferBinary) +var YAML = require('./yaml'), + util = require('./util'), + ono = require('ono'); - self.on('finish', function () { - self._onFinish() - }) -} +module.exports = parse; -inherits(ClientRequest, stream.Writable) +/** + * Parses the given data as YAML, JSON, or a raw Buffer (byte array), depending on the options. + * + * @param {string|Buffer} data - The data to be parsed + * @param {string} path - The file path or URL that `data` came from + * @param {$RefParserOptions} options + * + * @returns {string|Buffer|object} + * If `data` can be parsed as YAML or JSON, then the returned value is a JavaScript object. + * Otherwise, the returned value is the raw string or Buffer that was passed in. + */ +function parse(data, path, options) { + var parsed; -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return + try { + if (options.allow.yaml) { + util.debug('Parsing YAML file: %s', path); + parsed = YAML.parse(data.toString()); + util.debug(' Parsed successfully'); + } + else if (options.allow.json) { + util.debug('Parsing JSON file: %s', path); + parsed = JSON.parse(data.toString()); + util.debug(' Parsed successfully'); + } + else { + parsed = data; + } + } + catch (e) { + var ext = util.path.extname(path); + if (options.allow.unknown && ['.json', '.yaml', '.yml'].indexOf(ext) === -1) { + // It's not a YAML or JSON file, and unknown formats are allowed, + // so ignore the parsing error and just return the raw data + util.debug(' Unknown file format. Not parsed.'); + parsed = data; + } + else { + throw ono.syntax(e, 'Error parsing "%s"', path); + } + } - self._headers[lowerName] = { - name: name, - value: value - } -} + if (isEmpty(parsed) && !options.allow.empty) { + throw ono.syntax('Error parsing "%s". \nParsed value is empty', path); + } -ClientRequest.prototype.getHeader = function (name) { - var self = this - return self._headers[name.toLowerCase()].value + return parsed; } -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] +/** + * Determines whether the parsed value is "empty". + * + * @param {*} value + * @returns {boolean} + */ +function isEmpty(value) { + return !value || + (typeof value === 'object' && Object.keys(value).length === 0) || + (typeof value === 'string' && value.trim().length === 0) || + (value instanceof Buffer && value.length === 0); } -ClientRequest.prototype._onFinish = function () { - var self = this - - if (self._destroyed) - return - var opts = self._opts - - var headersObj = self._headers - var body - if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') { - if (capability.blobConstructor) { - body = new global.Blob(self._body.map(function (buffer) { - return toArrayBuffer(buffer) - }), { - type: (headersObj['content-type'] || {}).value || '' - }) - } else { - // get utf8 string - body = Buffer.concat(self._body).toString() - } - } - - if (self._mode === 'fetch') { - var headers = Object.keys(headersObj).map(function (name) { - return [headersObj[name].name, headersObj[name].value] - }) - - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headers, - body: body, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin' - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } +}).call(this,require("buffer").Buffer) - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode.split(':')[0] +},{"./util":68,"./yaml":69,"buffer":10,"ono":75}],62:[function(require,module,exports){ +'use strict'; - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials +module.exports = Pointer; - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') +var $Ref = require('./ref'), + util = require('./util'), + url = require('url'), + ono = require('ono'), + slashes = /\//g, + tildes = /~/g, + escapedSlash = /~1/g, + escapedTilde = /~0/g; - Object.keys(headersObj).forEach(function (name) { - xhr.setRequestHeader(headersObj[name].name, headersObj[name].value) - }) +/** + * This class represents a single JSON pointer and its resolved value. + * + * @param {$Ref} $ref + * @param {string} path + * @constructor + */ +function Pointer($ref, path) { + /** + * The {@link $Ref} object that contains this {@link Pointer} object. + * @type {$Ref} + */ + this.$ref = $ref; - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break - } - } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() - } - } + /** + * The file path or URL, containing the JSON pointer in the hash. + * This path is relative to the path of the main JSON schema file. + * @type {string} + */ + this.path = path; - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } + /** + * The value of the JSON pointer. + * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays). + * @type {?*} + */ + this.value = undefined; - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } + /** + * Indicates whether the pointer is references itself. + * @type {boolean} + */ + this.circular = false; } /** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 + * Resolves the value of a nested property within the given object. + * + * @param {*} obj - The object that will be crawled + * @param {$RefParserOptions} [options] + * + * @returns {Pointer} + * Returns a JSON pointer whose {@link Pointer#value} is the resolved value. + * If resolving this value required resolving other JSON references, then + * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path + * of the resolved value. */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } -} - -ClientRequest.prototype._onXHRProgress = function () { - var self = this - - if (!statusValid(self._xhr) || self._destroyed) - return +Pointer.prototype.resolve = function(obj, options) { + var tokens = Pointer.parse(this.path); - if (!self._response) - self._connect() + // Crawl the object, one token at a time + this.value = obj; + for (var i = 0; i < tokens.length; i++) { + if (resolveIf$Ref(this, options)) { + // The $ref path has changed, so append the remaining tokens to the path + this.path = Pointer.join(this.path, tokens.slice(i)); + } - self._response._onXHRProgress() -} + var token = tokens[i]; + if (this.value[token] === undefined) { + throw ono.syntax('Error resolving $ref pointer "%s". \nToken "%s" does not exist.', this.path, token); + } + else { + this.value = this.value[token]; + } + } -ClientRequest.prototype._connect = function () { - var self = this + // Resolve the final value + resolveIf$Ref(this, options); + return this; +}; - if (self._destroyed) - return +/** + * Sets the value of a nested property within the given object. + * + * @param {*} obj - The object that will be crawled + * @param {*} value - the value to assign + * @param {$RefParserOptions} [options] + * + * @returns {*} + * Returns the modified object, or an entirely new object if the entire object is overwritten. + */ +Pointer.prototype.set = function(obj, value, options) { + var tokens = Pointer.parse(this.path); + var token; - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode) - self.emit('response', self._response) -} + if (tokens.length === 0) { + // There are no tokens, replace the entire object with the new value + this.value = value; + return value; + } -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this + // Crawl the object, one token at a time + this.value = obj; + for (var i = 0; i < tokens.length - 1; i++) { + resolveIf$Ref(this, options); - self._body.push(chunk) - cb() -} + token = tokens[i]; + if (this.value && this.value[token] !== undefined) { + // The token exists + this.value = this.value[token]; + } + else { + // The token doesn't exist, so create it + this.value = setValue(this, token, {}); + } + } -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - // Currently, there isn't a way to truly abort a fetch. - // If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27 -} + // Set the value of the final token + resolveIf$Ref(this, options); + token = tokens[tokens.length - 1]; + setValue(this, token, value); -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } + // Return the updated object + return obj; +}; - stream.Writable.prototype.end.call(self, data, encoding, cb) -} +/** + * Parses a JSON pointer (or a path containing a JSON pointer in the hash) + * and returns an array of the pointer's tokens. + * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"]) + * + * The pointer is parsed according to RFC 6901 + * {@link https://tools.ietf.org/html/rfc6901#section-3} + * + * @param {string} path + * @returns {string[]} + */ +Pointer.parse = function(path) { + // Get the JSON pointer from the path's hash + var pointer = util.path.getHash(path).substr(1); -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} + // If there's no pointer, then there are no tokens, + // so return an empty array + if (!pointer) { + return []; + } -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'user-agent', - 'via' -] + // Split into an array + pointer = pointer.split('/'); -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) + // Decode each part, according to RFC 6901 + for (var i = 0; i < pointer.length; i++) { + pointer[i] = decodeURI(pointer[i].replace(escapedSlash, '/').replace(escapedTilde, '~')); + } -},{"./capability":95,"./response":97,"_process":78,"buffer":10,"inherits":20,"stream":93,"to-arraybuffer":101}],97:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('stream') + if (pointer[0] !== '') { + throw ono.syntax('Invalid $ref pointer "%s". Pointers must begin with "#/"', pointer); + } -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -} + return pointer.slice(1); +}; -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) { - var self = this - stream.Readable.call(self) +/** + * Creates a JSON pointer path, by joining one or more tokens to a base path. + * + * @param {string} base - The base path (e.g. "schema.json#/definitions/person") + * @param {string|string[]} tokens - The token(s) to append (e.g. ["name", "first"]) + * @returns {string} + */ +Pointer.join = function(base, tokens) { + // Ensure that the base path contains a hash + if (base.indexOf('#') === -1) { + base += '#'; + } - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] + // Append each token to the base path + tokens = Array.isArray(tokens) ? tokens : [tokens]; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + // Encode the token, according to RFC 6901 + base += '/' + encodeURI(token.replace(tildes, '~0').replace(slashes, '~1')); + } - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) + return base; +}; - if (mode === 'fetch') { - self._fetchResponse = response +/** + * If the given pointer's {@link Pointer#value} is a JSON reference, + * then the reference is resolved and {@link Pointer#value} is replaced with the resolved value. + * In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the + * resolution path of the new value. + * + * @param {Pointer} pointer + * @param {$RefParserOptions} [options] + * @returns {boolean} - Returns `true` if the resolution path changed + */ +function resolveIf$Ref(pointer, options) { + // Is the value a JSON reference? (and allowed?) + if ($Ref.isAllowed$Ref(pointer.value, options)) { + var $refPath = url.resolve(pointer.path, pointer.value.$ref); - self.statusCode = response.status - self.statusMessage = response.statusText - // backwards compatible version of for ( of ): - // for (var ,_i,_it = [Symbol.iterator](); = (_i = _it.next()).value,!_i.done;) - for (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) { - self.headers[header[0].toLowerCase()] = header[1] - self.rawHeaders.push(header[0], header[1]) - } + if ($refPath === pointer.path) { + // The value is a reference to itself, so there's nothing to do. + pointer.circular = true; + } + else { + // Does the JSON reference have other properties (other than "$ref")? + // If so, then don't resolve it, since it represents a new type + if (Object.keys(pointer.value).length === 1) { + // Resolve the reference + var resolved = pointer.$ref.$refs._resolve($refPath); + pointer.$ref = resolved.$ref; + pointer.path = resolved.path; + pointer.value = resolved.value; + return true; + } + } + } +} - // TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - self.push(null) - return - } - self.push(new Buffer(result.value)) - read() - }) - } - read() - - } else { - self._xhr = xhr - self._pos = 0 - - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) - - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } +/** + * Sets the specified token value of the {@link Pointer#value}. + * + * The token is evaluated according to RFC 6901. + * {@link https://tools.ietf.org/html/rfc6901#section-4} + * + * @param {Pointer} pointer - The JSON Pointer whose value will be modified + * @param {string} token - A JSON Pointer token that indicates how to modify `obj` + * @param {*} value - The value to assign + * @returns {*} - Returns the assigned value + */ +function setValue(pointer, token, value) { + if (pointer.value && typeof pointer.value === 'object') { + if (token === '-' && Array.isArray(pointer.value)) { + pointer.value.push(value); + } + else { + pointer.value[token] = value; + } + } + else { + throw ono.syntax('Error assigning $ref pointer "%s". \nCannot set "%s" of a non-object.', pointer.path, token); + } + return value; } -inherits(IncomingMessage, stream.Readable) +},{"./ref":65,"./util":68,"ono":75,"url":100}],63:[function(require,module,exports){ +arguments[4][3][0].apply(exports,arguments) +},{"dup":3,"es6-promise":17}],64:[function(require,module,exports){ +(function (process,Buffer){ +'use strict'; -IncomingMessage.prototype._read = function () {} +var fs = require('fs'), + http = require('http'), + https = require('https'), + parse = require('./parse'), + util = require('./util'), + $Ref = require('./ref'), + Promise = require('./promise'), + url = require('url'), + ono = require('ono'); -IncomingMessage.prototype._onXHRProgress = function () { - var self = this +module.exports = read; - var xhr = self._xhr +/** + * Reads the specified file path or URL, possibly from cache. + * + * @param {string} path - This path MUST already be resolved, since `read` doesn't know the resolution context + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves with an object that contains a {@link $Ref} + * and a flag indicating whether the {@link $Ref} came from cache or not. + */ +function read(path, $refs, options) { + try { + // Remove the URL fragment, if any + path = util.path.stripHash(path); + util.debug('Reading %s', path); + + // Return from cache, if possible + var $ref = $refs._get$Ref(path); + if ($ref && !$ref.isExpired()) { + util.debug(' cached from %s', $ref.pathType); + return Promise.resolve({ + $ref: $ref, + cached: true + }); + } - var response = null - switch (self._mode) { - case 'text:vbarray': // For IE9 - if (xhr.readyState !== rStates.DONE) - break - try { - // This fails in IE8 - response = new global.VBArray(xhr.responseBody).toArray() - } catch (e) {} - if (response !== null) { - self.push(new Buffer(response)) - break - } - // Falls through in IE8 - case 'text': - try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 - response = xhr.responseText - } catch (e) { - self._mode = 'text:vbarray' - break - } - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = new Buffer(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff + // Add a placeholder $ref to the cache, so we don't read this URL multiple times + $ref = new $Ref($refs, path); - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE) - break - response = xhr.response - self.push(new Buffer(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(new Buffer(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } + // Read and return the $ref + return read$Ref($ref, options); + } + catch (e) { + return Promise.reject(e); + } +} - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } +/** + * Reads the specified file path or URL and updates the given {@link $Ref} accordingly. + * + * @param {$Ref} $ref - The {@link $Ref} to read and update + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves with the updated {@link $Ref} object (the same instance that was passed in) + */ +function read$Ref($ref, options) { + try { + var promise = options.$refs.external && (read$RefFile($ref, options) || read$RefUrl($ref, options)); + + if (promise) { + return promise + .then(function(data) { + // Update the $ref with the parsed file contents + var value = parse(data, $ref.path, options); + $ref.setValue(value, options); + + return { + $ref: $ref, + cached: false + }; + }); + } + else { + return Promise.reject(ono.syntax('Unable to resolve $ref pointer "%s"', $ref.path)); + } + } + catch (e) { + return Promise.reject(e); + } } -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +/** + * If the given {@link $Ref#path} is a local file, then the file is read + * and {@link $Ref#type} is set to "fs". + * + * @param {$Ref} $ref - The {@link $Ref} to read and update + * @param {$RefParserOptions} options + * + * @returns {Promise|undefined} + * Returns a promise if {@link $Ref#path} is a local file. + * The promise resolves with the raw file contents. + */ +function read$RefFile($ref, options) { + if (process.browser || util.path.isUrl($ref.path)) { + return; + } -},{"./capability":95,"_process":78,"buffer":10,"inherits":20,"stream":93}],98:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. + $ref.pathType = 'fs'; + return new Promise(function(resolve, reject) { + var file; + try { + file = util.path.urlToLocalPath($ref.path); + } + catch (err) { + reject(ono.uri(err, 'Malformed URI: %s', $ref.path)); + } -var Buffer = require('buffer').Buffer; + util.debug('Opening file: %s', file); -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } + try { + fs.readFile(file, function(err, data) { + if (err) { + reject(ono(err, 'Error opening file "%s"', $ref.path)); + } + else { + resolve(data); + } + }); + } + catch (err) { + reject(ono(err, 'Error opening file "%s"', file)); + } + }); +} + +/** + * If the given {@link $Ref#path} is a URL, then the file is downloaded + * and {@link $Ref#type} is set to "http" or "https". + * + * @param {$Ref} $ref - The {@link $Ref} to read and update + * @param {$RefParserOptions} options + * + * @returns {Promise|undefined} + * Returns a promise if {@link $Ref#path} is a URL. + * The promise resolves with the raw file contents. + */ +function read$RefUrl($ref, options) { + var u = url.parse($ref.path); + if (process.browser && !u.protocol) { + // Use the protocol of the current page + u.protocol = url.parse(location.href).protocol; + } -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); + if (u.protocol === 'http:') { + $ref.pathType = 'http'; + return download(http, u, options); + } + else if (u.protocol === 'https:') { + $ref.pathType = 'https'; + return download(https, u, options); } } -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; +/** + * Downloads the specified file. + * + * @param {http|https} protocol - Download via HTTP or HTTPS + * @param {Url} u - A parsed {@link Url} object + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves with the raw downloaded data, or rejects if there is an HTTP error. + */ +function download(protocol, u, options) { + return new Promise(function(resolve, reject) { + try { + util.debug('Downloading file: %s', u); + var req = protocol.get( + { + hostname: u.hostname, + port: u.port, + path: u.path, + auth: u.auth + }, + onResponse + ); -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; + if (typeof req.setTimeout === 'function') { + req.setTimeout(5000); + } - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; + req.on('timeout', function() { + req.abort(); + }); - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; + req.on('error', function(err) { + reject(ono(err, 'Error downloading file "%s"', u.href)); + }); + } + catch (err) { + reject(ono(err, 'Error downloading file "%s"', u.href)); } - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); + /** + * Handles the response + * + * @param {Response} res + */ + function onResponse(res) { + var body; - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + res.on('data', function(data) { + if (body) { + body = Buffer.concat([new Buffer(body), new Buffer(data)]); + } + else { + body = data; + } + }); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; + res.on('end', function() { + if (res.statusCode >= 400) { + reject(ono('GET %s \nHTTP ERROR %d \n%s', u.href, res.statusCode, body)); + } + else if ((res.statusCode === 204 || !body || !body.length) && !options.allow.empty) { + reject(ono('GET %s \nHTTP 204: No Content', u.href)); + } + else { + resolve(body || ''); + } + }); - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; + res.on('error', function(err) { + reject(ono(err, 'Error downloading file "%s"', u.href)); + }); } - break; - } + }); +} - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); +}).call(this,require('_process'),require("buffer").Buffer) - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } +},{"./parse":61,"./promise":63,"./ref":65,"./util":68,"_process":77,"buffer":10,"fs":9,"http":93,"https":20,"ono":75,"url":100}],65:[function(require,module,exports){ +'use strict'; - charStr += buffer.toString(this.encoding, 0, end); +module.exports = $Ref; - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } +var Pointer = require('./pointer'), + util = require('./util'); - // or just emit the charStr - return charStr; -}; +/** + * This class represents a single JSON reference and its resolved value. + * + * @param {$Refs} $refs + * @param {string} path + * @constructor + */ +function $Ref($refs, path) { + path = util.path.stripHash(path); -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; + // Add this $ref to its parent collection + $refs._$refs[path] = this; - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; + /** + * The {@link $Refs} object that contains this {@link $Ref} object. + * @type {$Refs} + */ + this.$refs = $refs; - // See http://en.wikipedia.org/wiki/UTF-8#Description + /** + * The file path or URL of the referenced file. + * This path is relative to the path of the main JSON schema file. + * + * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file. + * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get + * specific JSON pointers within the file. + * + * @type {string} + */ + this.path = path; - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } + /** + * Indicates the type of {@link $Ref#path} (e.g. "fs", "http", or "https") + * @type {?string} + */ + this.pathType = undefined; - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } + /** + * The path TO this JSON reference from the root of the main JSON schema file. + * If the same JSON reference occurs multiple times in the schema, then this is the pointer to the + * FIRST occurrence. + * + * This property is used by the {@link $RefParser.bundle} method to re-map other JSON references. + * + * @type {string} + */ + this.pathFromRoot = '#'; - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; + /** + * The resolved value of the JSON reference. + * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays). + * @type {?*} + */ + this.value = undefined; -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); + /** + * The date/time that the cached value will expire. + * @type {?Date} + */ + this.expires = undefined; +} - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } +/** + * Determines whether the {@link $Ref#value} has expired. + * + * @returns {boolean} + */ +$Ref.prototype.isExpired = function() { + return !!(this.expires && this.expires <= new Date()); +}; - return res; +/** + * Immediately expires the {@link $Ref#value}. + */ +$Ref.prototype.expire = function() { + this.expires = new Date(); }; -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} +/** + * Sets the {@link $Ref#value} and renews the cache expiration. + * + * @param {*} value + * @param {$RefParserOptions} options + */ +$Ref.prototype.setValue = function(value, options) { + this.value = value; -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} + // Extend the cache expiration + var cacheDuration = options.cache[this.pathType]; + if (cacheDuration > 0) { + var expires = Date.now() + (cacheDuration * 1000); + this.expires = new Date(expires); + } +}; -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} +/** + * Determines whether the given JSON reference exists within this {@link $Ref#value}. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @returns {boolean} + */ +$Ref.prototype.exists = function(path) { + try { + this.resolve(path); + return true; + } + catch (e) { + return false; + } +}; -},{"buffer":10}],99:[function(require,module,exports){ -module.exports = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch']; +/** + * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @returns {*} - Returns the resolved value + */ +$Ref.prototype.get = function(path, options) { + return this.resolve(path, options).value; +}; -},{}],100:[function(require,module,exports){ -module.exports={ - "title": "A JSON Schema for Swagger 2.0 API.", - "id": "http://swagger.io/v2/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ - "swagger", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" +/** + * Resolves the given JSON reference within this {@link $Ref#value}. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @returns {Pointer} + */ +$Ref.prototype.resolve = function(path, options) { + var pointer = new Pointer(this, path); + return pointer.resolve(this.value, options); +}; + +/** + * Sets the value of a nested property within this {@link $Ref#value}. + * If the property, or any of its parents don't exist, they will be created. + * + * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash + * @param {*} value - The value to assign + * @param {$RefParserOptions} options + */ +$Ref.prototype.set = function(path, value, options) { + var pointer = new Pointer(this, path); + this.value = pointer.set(this.value, value, options); +}; + +/** + * Determines whether the given value is a JSON reference. + * + * @param {*} value - The value to inspect + * @returns {boolean} + */ +$Ref.is$Ref = function(value) { + return value && typeof value === 'object' && typeof value.$ref === 'string' && value.$ref.length > 0; +}; + +/** + * Determines whether the given value is an external JSON reference. + * + * @param {*} value - The value to inspect + * @returns {boolean} + */ +$Ref.isExternal$Ref = function(value) { + return $Ref.is$Ref(value) && value.$ref[0] !== '#'; +}; + +/** + * Determines whether the given value is a JSON reference, and whether it is allowed by the options. + * For example, if it references an external file, then options.$refs.external must be true. + * + * @param {*} value - The value to inspect + * @param {$RefParserOptions} options + * @returns {boolean} + */ +$Ref.isAllowed$Ref = function(value, options) { + if ($Ref.is$Ref(value)) { + if (value.$ref[0] === '#') { + if (options.$refs.internal) { + return true; + } } - }, - "properties": { - "swagger": { - "type": "string", - "enum": [ - "2.0" - ], - "description": "The Swagger version of this document." - }, - "info": { - "$ref": "#/definitions/info" - }, - "host": { - "type": "string", - "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", - "description": "The host (name or ip) of the API. Example: 'swagger.io'" - }, - "basePath": { - "type": "string", - "pattern": "^/", - "description": "The base path to the API. Example: '/api'." - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "consumes": { - "description": "A list of MIME types accepted by the API.", - "$ref": "#/definitions/mediaTypeList" - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "$ref": "#/definitions/mediaTypeList" - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "definitions": { - "$ref": "#/definitions/definitions" - }, - "parameters": { - "$ref": "#/definitions/parameterDefinitions" - }, - "responses": { - "$ref": "#/definitions/responseDefinitions" - }, - "security": { - "$ref": "#/definitions/security" - }, - "securityDefinitions": { - "$ref": "#/definitions/securityDefinitions" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" + else if (options.$refs.external) { + return true; } - }, - "definitions": { - "info": { - "type": "object", - "description": "General information about the API.", - "required": [ - "version", - "title" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "title": { - "type": "string", - "description": "A unique and precise title of the API." - }, - "version": { - "type": "string", - "description": "A semantic version number of the API." - }, - "description": { - "type": "string", - "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." - }, - "termsOfService": { - "type": "string", - "description": "The terms of service for the API." - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the owners of the API.", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information.", - "format": "uri" - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization.", - "format": "email" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "license": { - "type": "object", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the license type. It's encouraged to use an OSI compatible license." - }, - "url": { - "type": "string", - "description": "The URL pointing to the license.", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "paths": { - "type": "object", - "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false - }, - "definitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "description": "One or more JSON objects describing the schemas being consumed and produced by the API." - }, - "parameterDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameter" - }, - "description": "One or more JSON representations for parameters" - }, - "responseDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response" - }, - "description": "One or more JSON representations for parameters" - }, - "externalDocs": { - "type": "object", - "additionalProperties": false, - "description": "information about external documentation", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } + } +}; + +},{"./pointer":62,"./util":68}],66:[function(require,module,exports){ +'use strict'; + +var Options = require('./options'), + util = require('./util'), + ono = require('ono'); + +module.exports = $Refs; + +/** + * This class is a map of JSON references and their resolved values. + */ +function $Refs() { + /** + * Indicates whether the schema contains any circular references. + * + * @type {boolean} + */ + this.circular = false; + + /** + * A map of paths/urls to {@link $Ref} objects + * + * @type {object} + * @protected + */ + this._$refs = {}; +} + +/** + * Returns the paths of all the files/URLs that are referenced by the JSON schema, + * including the schema itself. + * + * @param {...string|string[]} [types] - Only return paths of the given types ("fs", "http", "https") + * @returns {string[]} + */ +$Refs.prototype.paths = function(types) { + var paths = getPaths(this._$refs, arguments); + return paths.map(function(path) { + return path.decoded; + }); +}; + +/** + * Returns the map of JSON references and their resolved values. + * + * @param {...string|string[]} [types] - Only return references of the given types ("fs", "http", "https") + * @returns {object} + */ +$Refs.prototype.values = function(types) { + var $refs = this._$refs; + var paths = getPaths($refs, arguments); + return paths.reduce(function(obj, path) { + obj[path.decoded] = $refs[path.encoded].value; + return obj; + }, {}); +}; + +/** + * Returns a POJO (plain old JavaScript object) for serialization as JSON. + * + * @returns {object} + */ +$Refs.prototype.toJSON = $Refs.prototype.values; + +/** + * Determines whether the given JSON reference has expired. + * Returns true if the reference does not exist. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @returns {boolean} + */ +$Refs.prototype.isExpired = function(path) { + var $ref = this._get$Ref(path); + return $ref === undefined || $ref.isExpired(); +}; + +/** + * Immediately expires the given JSON reference. + * If the reference does not exist, nothing happens. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + */ +$Refs.prototype.expire = function(path) { + var $ref = this._get$Ref(path); + if ($ref) { + $ref.expire(); + } +}; + +/** + * Determines whether the given JSON reference exists. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @returns {boolean} + */ +$Refs.prototype.exists = function(path) { + try { + this._resolve(path); + return true; + } + catch (e) { + return false; + } +}; + +/** + * Resolves the given JSON reference and returns the resolved value. + * + * @param {string} path - The full path being resolved, with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @returns {*} - Returns the resolved value + */ +$Refs.prototype.get = function(path, options) { + return this._resolve(path, options).value; +}; + +/** + * Sets the value of a nested property within this {@link $Ref#value}. + * If the property, or any of its parents don't exist, they will be created. + * + * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash + * @param {*} value - The value to assign + * @param {$RefParserOptions} options + */ +$Refs.prototype.set = function(path, value, options) { + var withoutHash = util.path.stripHash(path); + var $ref = this._$refs[withoutHash]; + + if (!$ref) { + throw ono('Error resolving $ref pointer "%s". \n"%s" not found.', path, withoutHash); + } + + options = new Options(options); + $ref.set(path, value, options); +}; + +/** + * Resolves the given JSON reference. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @returns {Pointer} + * @protected + */ +$Refs.prototype._resolve = function(path, options) { + var withoutHash = util.path.stripHash(path); + var $ref = this._$refs[withoutHash]; + + if (!$ref) { + throw ono('Error resolving $ref pointer "%s". \n"%s" not found.', path, withoutHash); + } + + options = new Options(options); + return $ref.resolve(path, options); +}; + +/** + * Returns the specified {@link $Ref} object, or undefined. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @returns {$Ref|undefined} + * @protected + */ +$Refs.prototype._get$Ref = function(path) { + var withoutHash = util.path.stripHash(path); + return this._$refs[withoutHash]; +}; + +/** + * Returns the encoded and decoded paths keys of the given object. + * + * @param {object} $refs - The object whose keys are URL-encoded paths + * @param {...string|string[]} [types] - Only return paths of the given types ("fs", "http", "https") + * @returns {object[]} + */ +function getPaths($refs, types) { + var paths = Object.keys($refs); + + // Filter the paths by type + types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types); + if (types.length > 0 && types[0]) { + paths = paths.filter(function(key) { + return types.indexOf($refs[key].pathType) !== -1; + }); + } + + // Decode local filesystem paths + return paths.map(function(path) { + return { + encoded: path, + decoded: $refs[path].pathType === 'fs' ? util.path.urlToLocalPath(path) : path + }; + }); +} + +},{"./options":60,"./util":68,"ono":75}],67:[function(require,module,exports){ +'use strict'; + +var Promise = require('./promise'), + $Ref = require('./ref'), + Pointer = require('./pointer'), + read = require('./read'), + util = require('./util'), + url = require('url'), + ono = require('ono'); + +module.exports = resolve; + +/** + * Crawls the JSON schema, finds all external JSON references, and resolves their values. + * This method does not mutate the JSON schema. The resolved values are added to {@link $RefParser#$refs}. + * + * NOTE: We only care about EXTERNAL references here. INTERNAL references are only relevant when dereferencing. + * + * @param {$RefParser} parser + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves once all JSON references in the schema have been resolved, + * including nested references that are contained in externally-referenced files. + */ +function resolve(parser, options) { + try { + if (!options.$refs.external) { + // Nothing to resolve, so exit early + return Promise.resolve(); + } + + util.debug('Resolving $ref pointers in %s', parser._basePath); + var promises = crawl(parser.schema, parser._basePath + '#', '#', parser.$refs, options); + return Promise.all(promises); + } + catch (e) { + return Promise.reject(e); + } +} + +/** + * Recursively crawls the given value, and resolves any external JSON references. + * + * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. + * @param {string} path - The file path or URL used to resolve relative JSON references. + * @param {string} pathFromRoot - The path to this point from the schema root + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * + * @returns {Promise[]} + * Returns an array of promises. There will be one promise for each JSON reference in `obj`. + * If `obj` does not contain any JSON references, then the array will be empty. + * If any of the JSON references point to files that contain additional JSON references, + * then the corresponding promise will internally reference an array of promises. + */ +function crawl(obj, path, pathFromRoot, $refs, options) { + var promises = []; + + if (obj && typeof obj === 'object') { + var keys = Object.keys(obj); + + // If there's a "definitions" property, then crawl it FIRST. + // This is important when bundling, since the expected behavior + // is to bundle everything into definitions if possible. + var defs = keys.indexOf('definitions'); + if (defs > 0) { + keys.splice(0, 0, keys.splice(defs, 1)[0]); + } + + keys.forEach(function(key) { + var keyPath = Pointer.join(path, key); + var keyPathFromRoot = Pointer.join(pathFromRoot, key); + var value = obj[key]; + + if ($Ref.isExternal$Ref(value)) { + // We found a $ref + util.debug('Resolving $ref pointer "%s" at %s', value.$ref, keyPath); + var $refPath = url.resolve(path, value.$ref); + + // Crawl the $referenced value + var promise = crawl$Ref($refPath, keyPathFromRoot, $refs, options) + .catch(function(err) { + throw ono.syntax(err, 'Error at %s', keyPath); + }); + promises.push(promise); } - }, - "examples": { - "type": "object", - "additionalProperties": true - }, - "mimeType": { - "type": "string", - "description": "The MIME type of the HTTP message." - }, - "operation": { - "type": "object", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string", - "description": "A brief summary of the operation." - }, - "description": { - "type": "string", - "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string", - "description": "A unique identifier of the operation." - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "$ref": "#/definitions/mediaTypeList" - }, - "consumes": { - "description": "A list of MIME types the API can consume.", - "$ref": "#/definitions/mediaTypeList" - }, - "parameters": { - "$ref": "#/definitions/parametersList" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "security": { - "$ref": "#/definitions/security" - } + else { + promises = promises.concat(crawl(value, keyPath, keyPathFromRoot, $refs, options)); } - }, - "pathItem": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "parameters": { - "$ref": "#/definitions/parametersList" - } + }); + } + return promises; +} + +/** + * Reads the file/URL at the given path, and then crawls the resulting value and resolves + * any external JSON references. + * + * @param {string} path - The file path or URL to crawl + * @param {string} pathFromRoot - The path to this point from the schema root + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves once all JSON references in the object have been resolved, + * including nested references that are contained in externally-referenced files. + */ +function crawl$Ref(path, pathFromRoot, $refs, options) { + return read(path, $refs, options) + .then(function(cached$Ref) { + // If a cached $ref is returned, then we DON'T need to crawl it + if (!cached$Ref.cached) { + var $ref = cached$Ref.$ref; + + // This is a new $ref, so store the path from the root of the JSON schema to this $ref + $ref.pathFromRoot = pathFromRoot; + + // Crawl the new $ref + util.debug('Resolving $ref pointers in %s', $ref.path); + var promises = crawl($ref.value, $ref.path + '#', pathFromRoot, $refs, options); + return Promise.all(promises); } - }, - "responses": { - "type": "object", - "description": "Response objects names can either be any valid HTTP status code or 'default'.", - "minProperties": 1, - "additionalProperties": false, - "patternProperties": { - "^([0-9]{3})$|^(default)$": { - "$ref": "#/definitions/responseValue" - }, - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "not": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } + }); +} + +},{"./pointer":62,"./promise":63,"./read":64,"./ref":65,"./util":68,"ono":75,"url":100}],68:[function(require,module,exports){ +(function (process){ +'use strict'; + +var debug = require('debug'), + isWindows = /^win/.test(process.platform), + forwardSlashPattern = /\//g, + protocolPattern = /^[a-z0-9.+-]+:\/\//i; + +// RegExp patterns to URL-encode special characters in local filesystem paths +var urlEncodePatterns = [ + /\?/g, '%3F', + /\#/g, '%23', + isWindows ? /\\/g : /\//, '/' +]; + +// RegExp patterns to URL-decode special characters for local filesystem paths +var urlDecodePatterns = [ + /\%23/g, '#', + /\%24/g, '$', + /\%26/g, '&', + /\%2C/g, ',', + /\%40/g, '@' +]; + +/** + * Writes messages to stdout. + * Log messages are suppressed by default, but can be enabled by setting the DEBUG variable. + * @type {function} + */ +exports.debug = debug('json-schema-ref-parser'); + +/** + * Utility functions for working with paths and URLs. + */ +exports.path = {}; + +/** + * Returns the current working directory (in Node) or the current page URL (in browsers). + * + * @returns {string} + */ +exports.path.cwd = function cwd() { + return process.browser ? location.href : process.cwd() + '/'; +}; + +/** + * Determines whether the given path is a URL. + * + * @param {string} path + * @returns {boolean} + */ +exports.path.isUrl = function isUrl(path) { + return protocolPattern.test(path); +}; + +/** + * If the given path is a local filesystem path, it is converted to a URL. + * + * @param {string} path + * @returns {string} + */ +exports.path.localPathToUrl = function localPathToUrl(path) { + if (!process.browser && !exports.path.isUrl(path)) { + // Manually encode characters that are not encoded by `encodeURI` + for (var i = 0; i < urlEncodePatterns.length; i += 2) { + path = path.replace(urlEncodePatterns[i], urlEncodePatterns[i + 1]); + } + path = encodeURI(path); + } + return path; +}; + +/** + * Converts a URL to a local filesystem path + * + * @param {string} url + * @returns {string} + */ +exports.path.urlToLocalPath = function urlToLocalPath(url) { + url = decodeURI(url); + // Manually decode characters that are not decoded by `decodeURI` + for (var i = 0; i < urlDecodePatterns.length; i += 2) { + url = url.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]); + } + if (isWindows) { + url = url.replace(forwardSlashPattern, '\\'); + } + return url; +}; + +/** + * Returns the hash (URL fragment), if any, of the given path. + * + * @param {string} path + * @returns {string} + */ +exports.path.getHash = function getHash(path) { + var hashIndex = path.indexOf('#'); + if (hashIndex >= 0) { + return path.substr(hashIndex); + } + return ''; +}; + +/** + * Removes the hash (URL fragment), if any, from the given path. + * + * @param {string} path + * @returns {string} + */ +exports.path.stripHash = function stripHash(path) { + var hashIndex = path.indexOf('#'); + if (hashIndex >= 0) { + path = path.substr(0, hashIndex); + } + return path; +}; + +/** + * Returns the file extension of the given path. + * + * @param {string} path + * @returns {string} + */ +exports.path.extname = function extname(path) { + var lastDot = path.lastIndexOf('.'); + if (lastDot >= 0) { + return path.substr(lastDot).toLowerCase(); + } + return ''; +}; + +}).call(this,require('_process')) + +},{"_process":77,"debug":15}],69:[function(require,module,exports){ +/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ +'use strict'; + +var yaml = require('js-yaml'), + ono = require('ono'); + +/** + * Simple YAML parsing functions, similar to {@link JSON.parse} and {@link JSON.stringify} + */ +module.exports = { + /** + * Parses a YAML string and returns the value. + * + * @param {string} text - The YAML string to be parsed + * @param {function} [reviver] - Not currently supported. Provided for consistency with {@link JSON.parse} + * @returns {*} + */ + parse: function yamlParse(text, reviver) { + try { + return yaml.safeLoad(text); + } + catch (e) { + if (e instanceof Error) { + throw e; } - }, - "responseValue": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "response": { - "type": "object", - "required": [ - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/fileSchema" - } - ] - }, - "headers": { - "$ref": "#/definitions/headers" - }, - "examples": { - "$ref": "#/definitions/examples" - } - }, - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } + else { + // https://github.com/nodeca/js-yaml/issues/153 + throw ono(e, e.message); } - }, - "headers": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/header" + } + }, + + /** + * Converts a JavaScript value to a YAML string. + * + * @param {*} value - The value to convert to YAML + * @param {function|array} replacer - Not currently supported. Provided for consistency with {@link JSON.stringify} + * @param {string|number} space - The number of spaces to use for indentation, or a string containing the number of spaces. + * @returns {string} + */ + stringify: function yamlStringify(value, replacer, space) { + try { + var indent = (typeof space === 'string' ? space.length : space) || 2; + return yaml.safeDump(value, {indent: indent}); + } + catch (e) { + if (e instanceof Error) { + throw e; } - }, - "header": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } + else { + // https://github.com/nodeca/js-yaml/issues/153 + throw ono(e, e.message); } - }, - "vendorExtension": { - "description": "Any property starting with x- is valid.", - "additionalProperties": true, - "additionalItems": true - }, - "bodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "schema" - ], - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "body" - ] - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "schema": { - "$ref": "#/definitions/schema" - } - }, - "additionalProperties": false - }, - "headerParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "header" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "queryParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "formDataParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "formData" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array", - "file" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "pathParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "required" - ], - "properties": { - "required": { - "type": "boolean", - "enum": [ - true - ], - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "path" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "nonBodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "type" - ], - "oneOf": [ - { - "$ref": "#/definitions/headerParameterSubSchema" - }, - { - "$ref": "#/definitions/formDataParameterSubSchema" - }, - { - "$ref": "#/definitions/queryParameterSubSchema" - }, - { - "$ref": "#/definitions/pathParameterSubSchema" - } - ] - }, - "parameter": { - "oneOf": [ - { - "$ref": "#/definitions/bodyParameter" - }, - { - "$ref": "#/definitions/nonBodyParameter" - } - ] - }, - "schema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "boolean" - } - ], - "default": {} - }, - "type": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/type" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - } - ], - "default": {} - }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, - "discriminator": { - "type": "string" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "fileSchema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "type" - ], - "properties": { - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "type": { - "type": "string", - "enum": [ - "file" - ] - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "primitivesItems": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "securityRequirement": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "xml": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "securityDefinitions": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/basicAuthenticationSecurity" - }, - { - "$ref": "#/definitions/apiKeySecurity" - }, - { - "$ref": "#/definitions/oauth2ImplicitSecurity" - }, - { - "$ref": "#/definitions/oauth2PasswordSecurity" - }, - { - "$ref": "#/definitions/oauth2ApplicationSecurity" - }, - { - "$ref": "#/definitions/oauth2AccessCodeSecurity" - } - ] - } - }, - "basicAuthenticationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "basic" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "apiKeySecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "name", - "in" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "apiKey" - ] - }, - "name": { - "type": "string" - }, - "in": { - "type": "string", - "enum": [ - "header", - "query" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ImplicitSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "implicit" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } + } + } +}; + +},{"js-yaml":27,"ono":75}],70:[function(require,module,exports){ +/** + * lodash 3.7.2 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + +/** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +module.exports = baseGet; + +},{}],71:[function(require,module,exports){ +/** + * lodash 3.8.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var isArray = require('lodash.isarray'); + +/** Used to match property names within property paths. */ +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + return value == null ? '' : (value + ''); +} + +/** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ +function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +} + +module.exports = toPath; + +},{"lodash.isarray":73}],72:[function(require,module,exports){ +/** + * lodash 3.7.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseGet = require('lodash._baseget'), + toPath = require('lodash._topath'); + +/** + * Gets the property value of `path` on `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, toPath(path), path + ''); + return result === undefined ? defaultValue : result; +} + +module.exports = get; + +},{"lodash._baseget":70,"lodash._topath":71}],73:[function(require,module,exports){ +/** + * lodash 3.0.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** `Object#toString` result references. */ +var arrayTag = '[object Array]', + funcTag = '[object Function]'; + +/** Used to detect host constructors (Safari > 5). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var fnToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsArray = getNative(Array, 'isArray'); + +/** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ +var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; +}; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); +} + +module.exports = isArray; + +},{}],74:[function(require,module,exports){ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} + +},{}],75:[function(require,module,exports){ +/**! + * Ono v2.0.1 + * + * @link https://github.com/BigstickCarpet/ono + * @license MIT + */ +'use strict'; + +var util = require('util'), + slice = Array.prototype.slice, + vendorSpecificErrorProperties = [ + 'name', 'message', 'description', 'number', 'fileName', 'lineNumber', 'columnNumber', + 'sourceURL', 'line', 'column', 'stack' + ]; + +module.exports = create(Error); +module.exports.error = create(Error); +module.exports.eval = create(EvalError); +module.exports.range = create(RangeError); +module.exports.reference = create(ReferenceError); +module.exports.syntax = create(SyntaxError); +module.exports.type = create(TypeError); +module.exports.uri = create(URIError); +module.exports.formatter = util.format; + +/** + * Creates a new {@link ono} function that creates the given Error class. + * + * @param {Class} Klass - The Error subclass to create + * @returns {ono} + */ +function create(Klass) { + /** + * @param {Error} [err] - The original error, if any + * @param {object} [props] - An object whose properties will be added to the error object + * @param {string} [message] - The error message. May contain {@link util#format} placeholders + * @param {...*} [params] - Parameters that map to the `message` placeholders + * @returns {Error} + */ + return function ono(err, props, message, params) { + var formattedMessage, stack; + var formatter = module.exports.formatter; + + if (typeof(err) === 'string') { + formattedMessage = formatter.apply(null, arguments); + err = props = undefined; + } + else if (typeof(props) === 'string') { + formattedMessage = formatter.apply(null, slice.call(arguments, 1)); + } + else { + formattedMessage = formatter.apply(null, slice.call(arguments, 2)); + } + + if (!(err instanceof Error)) { + props = err; + err = undefined; + } + + if (err) { + // The inner-error's message will be added to the new message + formattedMessage += (formattedMessage ? ' \n' : '') + err.message; + } + + // Create the new error + // NOTE: DON'T move this to a separate function! We don't want to pollute the stack trace + var newError = new Klass(formattedMessage); + + // Extend the new error with the additional properties + extendError(newError, err); // Copy properties of the original error + extendToJSON(newError); // Replace the original toJSON method + extend(newError, props); // Copy custom properties, possibly including a custom toJSON method + + return newError; + }; +} + +/** + * Extends the targetError with the properties of the source error. + * + * @param {Error} targetError - The error object to extend + * @param {?Error} sourceError - The source error object, if any + */ +function extendError(targetError, sourceError) { + if (sourceError) { + var stack = sourceError.stack; + if (stack) { + targetError.stack += ' \n\n' + sourceError.stack; + } + + extend(targetError, sourceError, true); + } +} + +/** + * JavaScript engines differ in how errors are serialized to JSON - especially when it comes + * to custom error properties and stack traces. So we add our own toJSON method that ALWAYS + * outputs every property of the error. + */ +function extendToJSON(error) { + error.toJSON = errorToJSON; + + // Also add an inspect() method, for compatibility with Node.js' `util.inspect()` method + error.inspect = errorToJSON; +} + +/** + * Extends the target object with the properties of the source object. + * + * @param {object} target - The object to extend + * @param {?source} source - The object whose properties are copied + * @param {boolean} omitVendorSpecificProperties - Skip vendor-specific Error properties + */ +function extend(target, source, omitVendorSpecificProperties) { + if (source && typeof(source) === 'object') { + var keys = Object.keys(source); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + // Don't bother trying to copy read-only vendor-specific Error properties + if (omitVendorSpecificProperties && vendorSpecificErrorProperties.indexOf(key) >= 0) { + continue; } - }, - "oauth2PasswordSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "password" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } + + try { + target[key] = source[key]; } - }, - "oauth2ApplicationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "application" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } + catch (e) { + // This property is read-only, so it can't be copied } - }, - "oauth2AccessCodeSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "accessCode" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" + } + } +} + +/** + * Custom JSON serializer for Error objects. + * Returns all built-in error properties, as well as extended properties. + * + * @returns {object} + */ +function errorToJSON() { + // jshint -W040 + var json = {}; + + // Get all the properties of this error + var keys = Object.keys(this); + + // Also include vendor-specific properties from the prototype + keys = keys.concat(vendorSpecificErrorProperties); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = this[key]; + if (value !== undefined) { + json[key] = value; + } + } + + return json; +} + +},{"util":104}],76:[function(require,module,exports){ +(function (process){ +'use strict'; + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} + +function nextTick(fn) { + var args = new Array(arguments.length - 1); + var i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + process.nextTick(function afterTick() { + fn.apply(null, args); + }); +} + +}).call(this,require('_process')) + +},{"_process":77}],77:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = setTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + clearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + setTimeout(drainQueue, 0); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],78:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.0 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],79:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],80:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],81:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":79,"./encode":80}],82:[function(require,module,exports){ +module.exports = require("./lib/_stream_duplex.js") + +},{"./lib/_stream_duplex.js":83}],83:[function(require,module,exports){ +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} +/**/ + + +module.exports = Duplex; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + + + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; +} + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +},{"./_stream_readable":85,"./_stream_writable":87,"core-util-is":14,"inherits":24,"process-nextick-args":76}],84:[function(require,module,exports){ +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; + +},{"./_stream_transform":86,"core-util-is":14,"inherits":24}],85:[function(require,module,exports){ +(function (process){ +'use strict'; + +module.exports = Readable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + + +/**/ +var isArray = require('isarray'); +/**/ + + +/**/ +var Buffer = require('buffer').Buffer; +/**/ + +Readable.ReadableState = ReadableState; + +var EE = require('events'); + +/**/ +var EElistenerCount = function(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + + + +/**/ +var Stream; +(function (){try{ + Stream = require('st' + 'ream'); +}catch(_){}finally{ + if (!Stream) + Stream = require('events').EventEmitter; +}}()) +/**/ + +var Buffer = require('buffer').Buffer; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + + + +/**/ +var debugUtil = require('util'); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var StringDecoder; + +util.inherits(Readable, Stream); + +var Duplex; +function ReadableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +var Duplex; +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options && typeof options.read === 'function') + this._read = options.read; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (!state.objectMode && typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +Readable.prototype.isPaused = function() { + return this._readableState.flowing === false; +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + if (!addToFront) + state.reading = false; + + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + + if (state.needReadable) + emitReadable(stream); } - }, - "oauth2Scopes": { - "type": "object", - "additionalProperties": { - "type": "string" + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (n === null || isNaN(n)) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = computeNewHighWaterMark(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else { + return state.length; + } + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + debug('read', n); + var state = this._readableState; + var nOrig = n; + + if (typeof n !== 'number' || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } + + if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended && state.length === 0) + endReadable(this); + + if (ret !== null) + this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!(Buffer.isBuffer(chunk)) && + typeof chunk !== 'string' && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) + processNextTick(emitReadable_, stream); + else + emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + processNextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + processNextTick(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && + (!dest._writableState || dest._writableState.needDrain)) + ondrain(); + } + + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + if (false === ret) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + if (state.pipesCount === 1 && + state.pipes[0] === dest && + src.listenerCount('data') === 1 && + !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; } - }, - "mediaTypeList": { - "type": "array", - "items": { - "$ref": "#/definitions/mimeType" - }, - "uniqueItems": true - }, - "parametersList": { - "type": "array", - "description": "The parameters needed to send a valid API call.", - "additionalItems": false, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "uniqueItems": true - }, - "schemesList": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ - "http", - "https", - "ws", - "wss" - ] - }, - "uniqueItems": true - }, - "collectionFormat": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes" - ], - "default": "csv" - }, - "collectionFormatWithMulti": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes", - "multi" - ], - "default": "csv" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "jsonReference": { - "type": "object", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. + if (!dest._events || !dest._events.error) + dest.on('error', onerror); + else if (isArray(dest._events.error)) + dest._events.error.unshift(onerror); + else + dest._events.error = [onerror, dest._events.error]; + + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + // If listening to data, and it has not explicitly been paused, + // then call resume to start the flow of data on the next tick. + if (ev === 'data' && false !== this._readableState.flowing) { + this.resume(); + } + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + processNextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + processNextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); +} + +Readable.prototype.pause = function() { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + if (state.flowing) { + do { + var chunk = stream.read(); + } while (null !== chunk && state.flowing); + } +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + debug('wrapped data'); + if (state.decoder) + chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }; }(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else if (list.length === 1) + ret = list[0]; + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; } } } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + processNextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +}).call(this,require('_process')) + +},{"./_stream_duplex":83,"_process":77,"buffer":10,"core-util-is":14,"events":19,"inherits":24,"isarray":26,"process-nextick-args":76,"string_decoder/":97,"util":8}],86:[function(require,module,exports){ +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(Transform, Duplex); + + +function TransformState(stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') + this._transform = options.transform; + + if (typeof options.flush === 'function') + this._flush = options.flush; + } + + this.once('prefinish', function() { + if (typeof this._flush === 'function') + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} + +},{"./_stream_duplex":83,"core-util-is":14,"inherits":24}],87:[function(require,module,exports){ +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +module.exports = Writable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + + +/**/ +var Buffer = require('buffer').Buffer; +/**/ + +Writable.WritableState = WritableState; + + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + + + +/**/ +var Stream; +(function (){try{ + Stream = require('st' + 'ream'); +}catch(_){}finally{ + if (!Stream) + Stream = require('events').EventEmitter; +}}()) +/**/ + +var Buffer = require('buffer').Buffer; + +util.inherits(Writable, Stream); + +function nop() {} + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +var Duplex; +function WritableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; +} + +WritableState.prototype.getBuffer = function writableStateGetBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function (){try { +Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + + 'instead.') +}); +}catch(_){}}()); + + +var Duplex; +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') + this._write = options.write; + + if (typeof options.writev === 'function') + this._writev = options.writev; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + processNextTick(cb, er); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + + if (!(Buffer.isBuffer(chunk)) && + typeof chunk !== 'string' && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + processNextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (typeof cb !== 'function') + cb = nop; + + if (state.ended) + writeAfterEnd(this, cb); + else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function() { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function() { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && + !state.corked && + !state.finished && + !state.bufferProcessing && + state.bufferedRequest) + clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') + encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', +'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw'] +.indexOf((encoding + '').toLowerCase()) > -1)) + throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + typeof chunk === 'string') { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; } -},{}],101:[function(require,module,exports){ -var Buffer = require('buffer').Buffer -module.exports = function (buf) { - // If the buffer is backed by a Uint8Array, a faster version will work - if (buf instanceof Uint8Array) { - // If the buffer isn't a subarray, return the underlying ArrayBuffer - if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { - return buf.buffer - } else if (typeof buf.buffer.slice === 'function') { - // Otherwise we need to get a proper copy - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) - } - } +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} - if (Buffer.isBuffer(buf)) { - // This is the slow version that will work with any Buffer - // implementation (even in old browsers) - var arrayCopy = new Uint8Array(buf.length) - var len = buf.length - for (var i = 0; i < len; i++) { - arrayCopy[i] = buf[i] - } - return arrayCopy.buffer - } else { - throw new Error('Argument must be a Buffer') - } +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) + processNextTick(cb, er); + else + cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); } -},{"buffer":10}],102:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; -'use strict'; + onwriteStateUpdate(state); -var punycode = require('punycode'); -var util = require('./util'); + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; + if (!finished && + !state.corked && + !state.bufferProcessing && + state.bufferedRequest) { + clearBuffer(stream, state); + } -exports.Url = Url; + if (sync) { + processNextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); } -// Reference: RFC 3986, RFC 1808, RFC 2396 +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var buffer = []; + var cbs = []; + while (entry) { + cbs.push(entry.callback); + buffer.push(entry); + entry = entry.next; + } - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + // count the one we are adding, as well. + // TODO(isaacs) clean this up + state.pendingcb++; + state.lastBufferedRequest = null; + doWrite(stream, state, true, state.length, buffer, '', function(err) { + for (var i = 0; i < cbs.length; i++) { + state.pendingcb--; + cbs[i](err); + } + }); - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = require('querystring'); + // Clear buffer + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; + if (entry === null) + state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; } -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); +}; - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); +Writable.prototype._writev = null; - var rest = url; +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } + if (chunk !== null && chunk !== undefined) + this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); } - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(state) { + return (state.ending && + state.length === 0 && + state.bufferedRequest === null && + !state.finished && + !state.writing); +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); } +} - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else { + prefinish(stream, state); } } + return need; +} - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + processNextTick(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c +},{"./_stream_duplex":83,"buffer":10,"core-util-is":14,"events":19,"inherits":24,"process-nextick-args":76,"util-deprecate":102}],88:[function(require,module,exports){ +module.exports = require("./lib/_stream_passthrough.js") - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. +},{"./lib/_stream_passthrough.js":84}],89:[function(require,module,exports){ +var Stream = (function (){ + try { + return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify + } catch(_){} +}()); +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream || exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } +},{"./lib/_stream_duplex.js":83,"./lib/_stream_passthrough.js":84,"./lib/_stream_readable.js":85,"./lib/_stream_transform.js":86,"./lib/_stream_writable.js":87}],90:[function(require,module,exports){ +module.exports = require("./lib/_stream_transform.js") - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } +},{"./lib/_stream_transform.js":86}],91:[function(require,module,exports){ +module.exports = require("./lib/_stream_writable.js") - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } +},{"./lib/_stream_writable.js":87}],92:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; +module.exports = Stream; - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); +var EE = require('events').EventEmitter; +var inherits = require('inherits'); - // pull out port. - this.parseHost(); +inherits(Stream, EE); +Stream.Readable = require('readable-stream/readable.js'); +Stream.Writable = require('readable-stream/writable.js'); +Stream.Duplex = require('readable-stream/duplex.js'); +Stream.Transform = require('readable-stream/transform.js'); +Stream.PassThrough = require('readable-stream/passthrough.js'); - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } +function Stream() { + EE.call(this); +} - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; +Stream.prototype.pipe = function(dest, options) { + var source = this; - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); } } } - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { + source.on('data', ondata); - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); + function ondrain() { + if (source.readable && source.resume) { + source.resume(); } } + dest.on('drain', ondrain); - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); } - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); } - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} + function onclose() { + if (didOnEnd) return; + didOnEnd = true; -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; + if (typeof dest.destroy === 'function') dest.destroy(); } - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. } } - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } + source.on('error', onerror); + dest.on('error', onerror); - var search = this.search || (query && ('?' + query)) || ''; + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + source.removeListener('end', onend); + source.removeListener('close', onclose); - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); } - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; + source.on('end', cleanup); + source.on('close', cleanup); - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); + dest.on('close', cleanup); - return protocol + host + pathname + search + hash; + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; }; -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} +},{"events":19,"inherits":24,"readable-stream/duplex.js":82,"readable-stream/passthrough.js":88,"readable-stream/readable.js":89,"readable-stream/transform.js":90,"readable-stream/writable.js":91}],93:[function(require,module,exports){ +var ClientRequest = require('./lib/request') +var extend = require('xtend') +var statusCodes = require('builtin-status-codes') +var url = require('url') -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; +var http = exports -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); +http.request = function (opts, cb) { + if (typeof opts === 'string') + opts = url.parse(opts) + else + opts = extend(opts) + + var protocol = opts.protocol || '' + var host = opts.hostname || opts.host + var port = opts.port + var path = opts.path || '/' + + // Necessary for IPv6 addresses + if (host && host.indexOf(':') !== -1) + host = '[' + host + ']' + + // This may be a relative url. The browser should always be able to interpret it correctly. + opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path + opts.method = (opts.method || 'GET').toUpperCase() + opts.headers = opts.headers || {} + + // Also valid opts.auth, opts.mode + + var req = new ClientRequest(opts) + if (cb) + req.on('response', cb) + return req } -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } +http.get = function get (opts, cb) { + var req = http.request(opts, cb) + req.end() + return req +} - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } +http.Agent = function () {} +http.Agent.defaultMaxSockets = 4 - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; +http.STATUS_CODES = statusCodes - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } +http.METHODS = [ + 'CHECKOUT', + 'CONNECT', + 'COPY', + 'DELETE', + 'GET', + 'HEAD', + 'LOCK', + 'M-SEARCH', + 'MERGE', + 'MKACTIVITY', + 'MKCOL', + 'MOVE', + 'NOTIFY', + 'OPTIONS', + 'PATCH', + 'POST', + 'PROPFIND', + 'PROPPATCH', + 'PURGE', + 'PUT', + 'REPORT', + 'SEARCH', + 'SUBSCRIBE', + 'TRACE', + 'UNLOCK', + 'UNSUBSCRIBE' +] +},{"./lib/request":95,"builtin-status-codes":12,"url":100,"xtend":106}],94:[function(require,module,exports){ +(function (global){ +exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableByteStream) - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } +exports.blobConstructor = false +try { + new Blob([new ArrayBuffer(1)]) + exports.blobConstructor = true +} catch (e) {} - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } +var xhr = new global.XMLHttpRequest() +// If location.host is empty, e.g. if this page/worker was loaded +// from a Blob, then use example.com to avoid an error +xhr.open('GET', global.location.host ? '/' : 'https://example.com') - result.href = result.format(); - return result; - } +function checkTypeSupport (type) { + try { + xhr.responseType = type + return xhr.responseType === type + } catch (e) {} + return false +} - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } +// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. +// Safari 7.1 appears to have fixed this bug. +var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' +var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } +exports.arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer') +// These next two tests unavoidably show warnings in Chrome. Since fetch will always +// be used if it's available, just return false for these to avoid the warnings. +exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') +exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && + checkTypeSupport('moz-chunked-arraybuffer') +exports.overrideMimeType = isFunction(xhr.overrideMimeType) +exports.vbArray = isFunction(global.VBArray) + +function isFunction (value) { + return typeof value === 'function' +} + +xhr = null // Help gc + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],95:[function(require,module,exports){ +(function (process,global,Buffer){ +// var Base64 = require('Base64') +var capability = require('./capability') +var inherits = require('inherits') +var response = require('./response') +var stream = require('stream') + +var IncomingMessage = response.IncomingMessage +var rStates = response.readyStates + +function decideMode (preferBinary) { + if (capability.fetch) { + return 'fetch' + } else if (capability.mozchunkedarraybuffer) { + return 'moz-chunked-arraybuffer' + } else if (capability.msstream) { + return 'ms-stream' + } else if (capability.arraybuffer && preferBinary) { + return 'arraybuffer' + } else if (capability.vbArray && preferBinary) { + return 'text:vbarray' + } else { + return 'text' + } +} - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; +var ClientRequest = module.exports = function (opts) { + var self = this + stream.Writable.call(self) - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } + self._opts = opts + self._body = [] + self._headers = {} + if (opts.auth) + self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) + Object.keys(opts.headers).forEach(function (name) { + self.setHeader(name, opts.headers[name]) + }) - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } + var preferBinary + if (opts.mode === 'prefer-streaming') { + // If streaming is a high priority but binary compatibility and + // the accuracy of the 'content-type' header aren't + preferBinary = false + } else if (opts.mode === 'allow-wrong-content-type') { + // If streaming is more important than preserving the 'content-type' header + preferBinary = !capability.overrideMimeType + } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { + // Use binary if text streaming may corrupt data or the content-type header, or for speed + preferBinary = true + } else { + throw new Error('Invalid value for opts.mode') + } + self._mode = decideMode(preferBinary) - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } + self.on('finish', function () { + self._onFinish() + }) +} - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); +inherits(ClientRequest, stream.Writable) - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } +ClientRequest.prototype.setHeader = function (name, value) { + var self = this + var lowerName = name.toLowerCase() + // This check is not necessary, but it prevents warnings from browsers about setting unsafe + // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but + // http-browserify did it, so I will too. + if (unsafeHeaders.indexOf(lowerName) !== -1) + return - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } + self._headers[lowerName] = { + name: name, + value: value + } +} - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } +ClientRequest.prototype.getHeader = function (name) { + var self = this + return self._headers[name.toLowerCase()].value +} - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } +ClientRequest.prototype.removeHeader = function (name) { + var self = this + delete self._headers[name.toLowerCase()] +} - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); +ClientRequest.prototype._onFinish = function () { + var self = this - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } + if (self._destroyed) + return + var opts = self._opts - mustEndAbs = mustEndAbs || (result.host && srcPath.length); + var headersObj = self._headers + var body + if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') { + if (capability.blobConstructor) { + body = new global.Blob(self._body.map(function (buffer) { + return buffer.toArrayBuffer() + }), { + type: (headersObj['content-type'] || {}).value || '' + }) + } else { + // get utf8 string + body = Buffer.concat(self._body).toString() + } + } - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } + if (self._mode === 'fetch') { + var headers = Object.keys(headersObj).map(function (name) { + return [headersObj[name].name, headersObj[name].value] + }) + + global.fetch(self._opts.url, { + method: self._opts.method, + headers: headers, + body: body, + mode: 'cors', + credentials: opts.withCredentials ? 'include' : 'same-origin' + }).then(function (response) { + self._fetchResponse = response + self._connect() + }, function (reason) { + self.emit('error', reason) + }) + } else { + var xhr = self._xhr = new global.XMLHttpRequest() + try { + xhr.open(self._opts.method, self._opts.url, true) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + + // Can't set responseType on really old browsers + if ('responseType' in xhr) + xhr.responseType = self._mode.split(':')[0] - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } + if ('withCredentials' in xhr) + xhr.withCredentials = !!opts.withCredentials - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; + if (self._mode === 'text' && 'overrideMimeType' in xhr) + xhr.overrideMimeType('text/plain; charset=x-user-defined') -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; + Object.keys(headersObj).forEach(function (name) { + xhr.setRequestHeader(headersObj[name].name, headersObj[name].value) + }) -},{"./util":103,"punycode":79,"querystring":82}],103:[function(require,module,exports){ -'use strict'; + self._response = null + xhr.onreadystatechange = function () { + switch (xhr.readyState) { + case rStates.LOADING: + case rStates.DONE: + self._onXHRProgress() + break + } + } + // Necessary for streaming in Firefox, since xhr.response is ONLY defined + // in onprogress, not in onreadystatechange with xhr.readyState = 3 + if (self._mode === 'moz-chunked-arraybuffer') { + xhr.onprogress = function () { + self._onXHRProgress() + } + } -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; + xhr.onerror = function () { + if (self._destroyed) + return + self.emit('error', new Error('XHR error')) + } -},{}],104:[function(require,module,exports){ -(function (global){ + try { + xhr.send(body) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + } +} /** - * Module exports. + * Checks if xhr.status is readable. Even though the spec says it should + * be available in readyState 3, accessing it throws an exception in IE8 */ +function statusValid (xhr) { + try { + return (xhr.status !== null) + } catch (e) { + return false + } +} -module.exports = deprecate; +ClientRequest.prototype._onXHRProgress = function () { + var self = this -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ + if (!statusValid(self._xhr) || self._destroyed) + return -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } + if (!self._response) + self._connect() - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } + self._response._onXHRProgress() +} - return deprecated; +ClientRequest.prototype._connect = function () { + var self = this + + if (self._destroyed) + return + + self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode) + self.emit('response', self._response) } -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ +ClientRequest.prototype._write = function (chunk, encoding, cb) { + var self = this -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; + self._body.push(chunk) + cb() } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { + var self = this + self._destroyed = true + if (self._response) + self._response._destroyed = true + if (self._xhr) + self._xhr.abort() + // Currently, there isn't a way to truly abort a fetch. + // If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27 +} -},{}],105:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; +ClientRequest.prototype.end = function (data, encoding, cb) { + var self = this + if (typeof data === 'function') { + cb = data + data = undefined + } + + stream.Writable.prototype.end.call(self, data, encoding, cb) +} + +ClientRequest.prototype.flushHeaders = function () {} +ClientRequest.prototype.setTimeout = function () {} +ClientRequest.prototype.setNoDelay = function () {} +ClientRequest.prototype.setSocketKeepAlive = function () {} + +// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method +var unsafeHeaders = [ + 'accept-charset', + 'accept-encoding', + 'access-control-request-headers', + 'access-control-request-method', + 'connection', + 'content-length', + 'cookie', + 'cookie2', + 'date', + 'dnt', + 'expect', + 'host', + 'keep-alive', + 'origin', + 'referer', + 'te', + 'trailer', + 'transfer-encoding', + 'upgrade', + 'user-agent', + 'via' +] + +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) + +},{"./capability":94,"./response":96,"_process":77,"buffer":10,"inherits":24,"stream":92}],96:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var stream = require('stream') + +var rStates = exports.readyStates = { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 } -},{}],106:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } +var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) { + var self = this + stream.Readable.call(self) - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; + self._mode = mode + self.headers = {} + self.rawHeaders = [] + self.trailers = {} + self.rawTrailers = [] + // Fake the 'close' event, but only once 'end' fires + self.on('end', function () { + // The nextTick is necessary to prevent the 'request' module from causing an infinite loop + process.nextTick(function () { + self.emit('close') + }) + }) -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } + if (mode === 'fetch') { + self._fetchResponse = response - if (process.noDeprecation === true) { - return fn; - } + self.statusCode = response.status + self.statusMessage = response.statusText + // backwards compatible version of for ( of ): + // for (var ,_i,_it = [Symbol.iterator](); = (_i = _it.next()).value,!_i.done;) + for (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) { + self.headers[header[0].toLowerCase()] = header[1] + self.rawHeaders.push(header[0], header[1]) + } - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } + // TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed + var reader = response.body.getReader() + function read () { + reader.read().then(function (result) { + if (self._destroyed) + return + if (result.done) { + self.push(null) + return + } + self.push(new Buffer(result.value)) + read() + }) + } + read() - return deprecated; -}; + } else { + self._xhr = xhr + self._pos = 0 + self.statusCode = xhr.status + self.statusMessage = xhr.statusText + var headers = xhr.getAllResponseHeaders().split(/\r?\n/) + headers.forEach(function (header) { + var matches = header.match(/^([^:]+):\s*(.*)/) + if (matches) { + var key = matches[1].toLowerCase() + if (self.headers[key] !== undefined) + self.headers[key] += ', ' + matches[2] + else + self.headers[key] = matches[2] + self.rawHeaders.push(matches[1], matches[2]) + } + }) -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; + self._charset = 'x-user-defined' + if (!capability.overrideMimeType) { + var mimeType = self.rawHeaders['mime-type'] + if (mimeType) { + var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) + if (charsetMatch) { + self._charset = charsetMatch[1].toLowerCase() + } + } + if (!self._charset) + self._charset = 'utf-8' // best guess + } + } +} +inherits(IncomingMessage, stream.Readable) -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); +IncomingMessage.prototype._read = function () {} + +IncomingMessage.prototype._onXHRProgress = function () { + var self = this + + var xhr = self._xhr + + var response = null + switch (self._mode) { + case 'text:vbarray': // For IE9 + if (xhr.readyState !== rStates.DONE) + break + try { + // This fails in IE8 + response = new global.VBArray(xhr.responseBody).toArray() + } catch (e) {} + if (response !== null) { + self.push(new Buffer(response)) + break + } + // Falls through in IE8 + case 'text': + try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 + response = xhr.responseText + } catch (e) { + self._mode = 'text:vbarray' + break + } + if (response.length > self._pos) { + var newData = response.substr(self._pos) + if (self._charset === 'x-user-defined') { + var buffer = new Buffer(newData.length) + for (var i = 0; i < newData.length; i++) + buffer[i] = newData.charCodeAt(i) & 0xff + + self.push(buffer) + } else { + self.push(newData, self._charset) + } + self._pos = response.length + } + break + case 'arraybuffer': + if (xhr.readyState !== rStates.DONE) + break + response = xhr.response + self.push(new Buffer(new Uint8Array(response))) + break + case 'moz-chunked-arraybuffer': // take whole + response = xhr.response + if (xhr.readyState !== rStates.LOADING || !response) + break + self.push(new Buffer(new Uint8Array(response))) + break + case 'ms-stream': + response = xhr.response + if (xhr.readyState !== rStates.LOADING) + break + var reader = new global.MSStreamReader() + reader.onprogress = function () { + if (reader.result.byteLength > self._pos) { + self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) + self._pos = reader.result.byteLength + } + } + reader.onload = function () { + self.push(null) + } + // reader.onerror = ??? // TODO: this + reader.readAsArrayBuffer(response) + break + } + + // The ms-stream case handles end separately in reader.onload() + if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { + self.push(null) + } } -exports.inspect = inspect; +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; +},{"./capability":94,"_process":77,"buffer":10,"inherits":24,"stream":92}],97:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; +var Buffer = require('buffer').Buffer; +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + } -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); } } +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +}; - array.forEach(function(val, idx) { - hash[val] = true; - }); - return hash; -} +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; } - if (isError(value)) { - return formatError(value); + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; } + break; } - var base = '', array = false, braces = ['{', '}']; + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; } - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } + charStr += buffer.toString(this.encoding, 0, end); - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); } - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } + // or just emit the charStr + return charStr; +}; + +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } + // See http://en.wikipedia.org/wiki/UTF-8#Description - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; } - } - ctx.seen.push(value); + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } } + this.charReceived = i; +}; - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} + return res; +}; -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); } +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; } +},{"buffer":10}],98:[function(require,module,exports){ +module.exports = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch']; -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); +},{}],99:[function(require,module,exports){ +module.exports={ + "title": "A JSON Schema for Swagger 2.0 API.", + "id": "http://swagger.io/v2/schema.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "required": [ + "swagger", + "info", + "paths" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); + }, + "properties": { + "swagger": { + "type": "string", + "enum": [ + "2.0" + ], + "description": "The Swagger version of this document." + }, + "info": { + "$ref": "#/definitions/info" + }, + "host": { + "type": "string", + "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", + "description": "The host (name or ip) of the API. Example: 'swagger.io'" + }, + "basePath": { + "type": "string", + "pattern": "^/", + "description": "The base path to the API. Example: '/api'." + }, + "schemes": { + "$ref": "#/definitions/schemesList" + }, + "consumes": { + "description": "A list of MIME types accepted by the API.", + "$ref": "#/definitions/mediaTypeList" + }, + "produces": { + "description": "A list of MIME types the API can produce.", + "$ref": "#/definitions/mediaTypeList" + }, + "paths": { + "$ref": "#/definitions/paths" + }, + "definitions": { + "$ref": "#/definitions/definitions" + }, + "parameters": { + "$ref": "#/definitions/parameterDefinitions" + }, + "responses": { + "$ref": "#/definitions/responseDefinitions" + }, + "security": { + "$ref": "#/definitions/security" + }, + "securityDefinitions": { + "$ref": "#/definitions/securityDefinitions" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/tag" + }, + "uniqueItems": true + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); + }, + "definitions": { + "info": { + "type": "object", + "description": "General information about the API.", + "required": [ + "version", + "title" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "title": { + "type": "string", + "description": "A unique and precise title of the API." + }, + "version": { + "type": "string", + "description": "A semantic version number of the API." + }, + "description": { + "type": "string", + "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." + }, + "termsOfService": { + "type": "string", + "description": "The terms of service for the API." + }, + "contact": { + "$ref": "#/definitions/contact" + }, + "license": { + "$ref": "#/definitions/license" + } + } + }, + "contact": { + "type": "object", + "description": "Contact information for the owners of the API.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The identifying name of the contact person/organization." + }, + "url": { + "type": "string", + "description": "The URL pointing to the contact information.", + "format": "uri" + }, + "email": { + "type": "string", + "description": "The email address of the contact person/organization.", + "format": "email" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "license": { + "type": "object", + "required": [ + "name" + ], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the license type. It's encouraged to use an OSI compatible license." + }, + "url": { + "type": "string", + "description": "The URL pointing to the license.", + "format": "uri" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "paths": { + "type": "object", + "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + }, + "^/": { + "$ref": "#/definitions/pathItem" + } + }, + "additionalProperties": false + }, + "definitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "description": "One or more JSON objects describing the schemas being consumed and produced by the API." + }, + "parameterDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/parameter" + }, + "description": "One or more JSON representations for parameters" + }, + "responseDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/response" + }, + "description": "One or more JSON representations for parameters" + }, + "externalDocs": { + "type": "object", + "additionalProperties": false, + "description": "information about external documentation", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "examples": { + "type": "object", + "additionalProperties": true + }, + "mimeType": { + "type": "string", + "description": "The MIME type of the HTTP message." + }, + "operation": { + "type": "object", + "required": [ + "responses" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "summary": { + "type": "string", + "description": "A brief summary of the operation." + }, + "description": { + "type": "string", + "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "operationId": { + "type": "string", + "description": "A unique identifier of the operation." + }, + "produces": { + "description": "A list of MIME types the API can produce.", + "$ref": "#/definitions/mediaTypeList" + }, + "consumes": { + "description": "A list of MIME types the API can consume.", + "$ref": "#/definitions/mediaTypeList" + }, + "parameters": { + "$ref": "#/definitions/parametersList" + }, + "responses": { + "$ref": "#/definitions/responses" + }, + "schemes": { + "$ref": "#/definitions/schemesList" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "security": { + "$ref": "#/definitions/security" + } + } + }, + "pathItem": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "get": { + "$ref": "#/definitions/operation" + }, + "put": { + "$ref": "#/definitions/operation" + }, + "post": { + "$ref": "#/definitions/operation" + }, + "delete": { + "$ref": "#/definitions/operation" + }, + "options": { + "$ref": "#/definitions/operation" + }, + "head": { + "$ref": "#/definitions/operation" + }, + "patch": { + "$ref": "#/definitions/operation" + }, + "parameters": { + "$ref": "#/definitions/parametersList" + } + } + }, + "responses": { + "type": "object", + "description": "Response objects names can either be any valid HTTP status code or 'default'.", + "minProperties": 1, + "additionalProperties": false, + "patternProperties": { + "^([0-9]{3})$|^(default)$": { + "$ref": "#/definitions/responseValue" + }, + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "not": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + } + }, + "responseValue": { + "oneOf": [ + { + "$ref": "#/definitions/response" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "response": { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "string" + }, + "schema": { + "oneOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "$ref": "#/definitions/fileSchema" + } + ] + }, + "headers": { + "$ref": "#/definitions/headers" + }, + "examples": { + "$ref": "#/definitions/examples" + } + }, + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/header" + } + }, + "header": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "vendorExtension": { + "description": "Any property starting with x- is valid.", + "additionalProperties": true, + "additionalItems": true + }, + "bodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "schema" + ], + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "body" + ] + }, + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "schema": { + "$ref": "#/definitions/schema" + } + }, + "additionalProperties": false + }, + "headerParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "header" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "queryParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "allowEmptyValue": { + "type": "boolean", + "default": false, + "description": "allows sending a parameter by name only or with an empty value." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "formDataParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "formData" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "allowEmptyValue": { + "type": "boolean", + "default": false, + "description": "allows sending a parameter by name only or with an empty value." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array", + "file" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "pathParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "required": [ + "required" + ], + "properties": { + "required": { + "type": "boolean", + "enum": [ + true + ], + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "path" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "nonBodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "type" + ], + "oneOf": [ + { + "$ref": "#/definitions/headerParameterSubSchema" + }, + { + "$ref": "#/definitions/formDataParameterSubSchema" + }, + { + "$ref": "#/definitions/queryParameterSubSchema" + }, + { + "$ref": "#/definitions/pathParameterSubSchema" + } + ] + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/bodyParameter" + }, + { + "$ref": "#/definitions/nonBodyParameter" + } + ] + }, + "schema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "maxProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "boolean" + } + ], + "default": {} + }, + "type": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/type" + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + } + ], + "default": {} + }, + "allOf": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "default": {} + }, + "discriminator": { + "type": "string" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/xml" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + }, + "fileSchema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "required": [ + "type" + ], + "properties": { + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "type": { + "type": "string", + "enum": [ + "file" + ] + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + }, + "primitivesItems": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "security": { + "type": "array", + "items": { + "$ref": "#/definitions/securityRequirement" + }, + "uniqueItems": true + }, + "securityRequirement": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "xml": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "tag": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "securityDefinitions": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/basicAuthenticationSecurity" + }, + { + "$ref": "#/definitions/apiKeySecurity" + }, + { + "$ref": "#/definitions/oauth2ImplicitSecurity" + }, + { + "$ref": "#/definitions/oauth2PasswordSecurity" + }, + { + "$ref": "#/definitions/oauth2ApplicationSecurity" + }, + { + "$ref": "#/definitions/oauth2AccessCodeSecurity" + } + ] + } + }, + "basicAuthenticationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "basic" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "apiKeySecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "name", + "in" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "apiKey" + ] + }, + "name": { + "type": "string" + }, + "in": { + "type": "string", + "enum": [ + "header", + "query" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ImplicitSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "implicit" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2PasswordSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "password" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ApplicationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "application" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); + }, + "oauth2AccessCodeSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "accessCode" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" } } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + }, + "oauth2Scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mediaTypeList": { + "type": "array", + "items": { + "$ref": "#/definitions/mimeType" + }, + "uniqueItems": true + }, + "parametersList": { + "type": "array", + "description": "The parameters needed to send a valid API call.", + "additionalItems": false, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/parameter" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "uniqueItems": true + }, + "schemesList": { + "type": "array", + "description": "The transfer protocol of the API.", + "items": { + "type": "string", + "enum": [ + "http", + "https", + "ws", + "wss" + ] + }, + "uniqueItems": true + }, + "collectionFormat": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes" + ], + "default": "csv" + }, + "collectionFormatWithMulti": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes", + "multi" + ], + "default": "csv" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "jsonReference": { + "type": "object", + "required": [ + "$ref" + ], + "additionalProperties": false, + "properties": { + "$ref": { + "type": "string" + } + } + } } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); } +},{}],100:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"./support/isBuffer":105,"_process":78,"inherits":20}],107:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _toDate = require('./lib/toDate'); - -var _toDate2 = _interopRequireDefault(_toDate); - -var _toFloat = require('./lib/toFloat'); - -var _toFloat2 = _interopRequireDefault(_toFloat); - -var _toInt = require('./lib/toInt'); - -var _toInt2 = _interopRequireDefault(_toInt); - -var _toBoolean = require('./lib/toBoolean'); - -var _toBoolean2 = _interopRequireDefault(_toBoolean); - -var _equals = require('./lib/equals'); - -var _equals2 = _interopRequireDefault(_equals); - -var _contains = require('./lib/contains'); - -var _contains2 = _interopRequireDefault(_contains); - -var _matches = require('./lib/matches'); - -var _matches2 = _interopRequireDefault(_matches); - -var _isEmail = require('./lib/isEmail'); - -var _isEmail2 = _interopRequireDefault(_isEmail); - -var _isURL = require('./lib/isURL'); - -var _isURL2 = _interopRequireDefault(_isURL); - -var _isMACAddress = require('./lib/isMACAddress'); - -var _isMACAddress2 = _interopRequireDefault(_isMACAddress); - -var _isIP = require('./lib/isIP'); - -var _isIP2 = _interopRequireDefault(_isIP); - -var _isFQDN = require('./lib/isFQDN'); - -var _isFQDN2 = _interopRequireDefault(_isFQDN); - -var _isBoolean = require('./lib/isBoolean'); - -var _isBoolean2 = _interopRequireDefault(_isBoolean); - -var _isAlpha = require('./lib/isAlpha'); - -var _isAlpha2 = _interopRequireDefault(_isAlpha); - -var _isAlphanumeric = require('./lib/isAlphanumeric'); - -var _isAlphanumeric2 = _interopRequireDefault(_isAlphanumeric); - -var _isNumeric = require('./lib/isNumeric'); - -var _isNumeric2 = _interopRequireDefault(_isNumeric); - -var _isLowercase = require('./lib/isLowercase'); - -var _isLowercase2 = _interopRequireDefault(_isLowercase); - -var _isUppercase = require('./lib/isUppercase'); - -var _isUppercase2 = _interopRequireDefault(_isUppercase); - -var _isAscii = require('./lib/isAscii'); - -var _isAscii2 = _interopRequireDefault(_isAscii); - -var _isFullWidth = require('./lib/isFullWidth'); - -var _isFullWidth2 = _interopRequireDefault(_isFullWidth); - -var _isHalfWidth = require('./lib/isHalfWidth'); - -var _isHalfWidth2 = _interopRequireDefault(_isHalfWidth); - -var _isVariableWidth = require('./lib/isVariableWidth'); - -var _isVariableWidth2 = _interopRequireDefault(_isVariableWidth); - -var _isMultibyte = require('./lib/isMultibyte'); - -var _isMultibyte2 = _interopRequireDefault(_isMultibyte); - -var _isSurrogatePair = require('./lib/isSurrogatePair'); - -var _isSurrogatePair2 = _interopRequireDefault(_isSurrogatePair); - -var _isInt = require('./lib/isInt'); - -var _isInt2 = _interopRequireDefault(_isInt); - -var _isFloat = require('./lib/isFloat'); - -var _isFloat2 = _interopRequireDefault(_isFloat); - -var _isDecimal = require('./lib/isDecimal'); - -var _isDecimal2 = _interopRequireDefault(_isDecimal); - -var _isHexadecimal = require('./lib/isHexadecimal'); - -var _isHexadecimal2 = _interopRequireDefault(_isHexadecimal); - -var _isDivisibleBy = require('./lib/isDivisibleBy'); - -var _isDivisibleBy2 = _interopRequireDefault(_isDivisibleBy); - -var _isHexColor = require('./lib/isHexColor'); - -var _isHexColor2 = _interopRequireDefault(_isHexColor); - -var _isJSON = require('./lib/isJSON'); - -var _isJSON2 = _interopRequireDefault(_isJSON); - -var _isNull = require('./lib/isNull'); - -var _isNull2 = _interopRequireDefault(_isNull); - -var _isLength = require('./lib/isLength'); - -var _isLength2 = _interopRequireDefault(_isLength); - -var _isByteLength = require('./lib/isByteLength'); - -var _isByteLength2 = _interopRequireDefault(_isByteLength); - -var _isUUID = require('./lib/isUUID'); - -var _isUUID2 = _interopRequireDefault(_isUUID); - -var _isMongoId = require('./lib/isMongoId'); - -var _isMongoId2 = _interopRequireDefault(_isMongoId); - -var _isDate = require('./lib/isDate'); - -var _isDate2 = _interopRequireDefault(_isDate); - -var _isAfter = require('./lib/isAfter'); - -var _isAfter2 = _interopRequireDefault(_isAfter); - -var _isBefore = require('./lib/isBefore'); - -var _isBefore2 = _interopRequireDefault(_isBefore); - -var _isIn = require('./lib/isIn'); - -var _isIn2 = _interopRequireDefault(_isIn); - -var _isCreditCard = require('./lib/isCreditCard'); - -var _isCreditCard2 = _interopRequireDefault(_isCreditCard); - -var _isISIN = require('./lib/isISIN'); - -var _isISIN2 = _interopRequireDefault(_isISIN); - -var _isISBN = require('./lib/isISBN'); - -var _isISBN2 = _interopRequireDefault(_isISBN); - -var _isMobilePhone = require('./lib/isMobilePhone'); - -var _isMobilePhone2 = _interopRequireDefault(_isMobilePhone); - -var _isCurrency = require('./lib/isCurrency'); - -var _isCurrency2 = _interopRequireDefault(_isCurrency); - -var _isISO = require('./lib/isISO8601'); - -var _isISO2 = _interopRequireDefault(_isISO); - -var _isBase = require('./lib/isBase64'); - -var _isBase2 = _interopRequireDefault(_isBase); - -var _isDataURI = require('./lib/isDataURI'); - -var _isDataURI2 = _interopRequireDefault(_isDataURI); - -var _ltrim = require('./lib/ltrim'); - -var _ltrim2 = _interopRequireDefault(_ltrim); - -var _rtrim = require('./lib/rtrim'); - -var _rtrim2 = _interopRequireDefault(_rtrim); - -var _trim = require('./lib/trim'); - -var _trim2 = _interopRequireDefault(_trim); - -var _escape = require('./lib/escape'); - -var _escape2 = _interopRequireDefault(_escape); - -var _unescape = require('./lib/unescape'); - -var _unescape2 = _interopRequireDefault(_unescape); - -var _stripLow = require('./lib/stripLow'); - -var _stripLow2 = _interopRequireDefault(_stripLow); - -var _whitelist = require('./lib/whitelist'); - -var _whitelist2 = _interopRequireDefault(_whitelist); - -var _blacklist = require('./lib/blacklist'); - -var _blacklist2 = _interopRequireDefault(_blacklist); - -var _isWhitelisted = require('./lib/isWhitelisted'); - -var _isWhitelisted2 = _interopRequireDefault(_isWhitelisted); - -var _normalizeEmail = require('./lib/normalizeEmail'); - -var _normalizeEmail2 = _interopRequireDefault(_normalizeEmail); - -var _toString = require('./lib/util/toString'); - -var _toString2 = _interopRequireDefault(_toString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var version = '5.2.0'; - -var validator = { - version: version, - toDate: _toDate2.default, - toFloat: _toFloat2.default, toInt: _toInt2.default, - toBoolean: _toBoolean2.default, - equals: _equals2.default, contains: _contains2.default, matches: _matches2.default, - isEmail: _isEmail2.default, isURL: _isURL2.default, isMACAddress: _isMACAddress2.default, isIP: _isIP2.default, isFQDN: _isFQDN2.default, - isBoolean: _isBoolean2.default, - isAlpha: _isAlpha2.default, isAlphanumeric: _isAlphanumeric2.default, isNumeric: _isNumeric2.default, isLowercase: _isLowercase2.default, isUppercase: _isUppercase2.default, - isAscii: _isAscii2.default, isFullWidth: _isFullWidth2.default, isHalfWidth: _isHalfWidth2.default, isVariableWidth: _isVariableWidth2.default, - isMultibyte: _isMultibyte2.default, isSurrogatePair: _isSurrogatePair2.default, - isInt: _isInt2.default, isFloat: _isFloat2.default, isDecimal: _isDecimal2.default, isHexadecimal: _isHexadecimal2.default, isDivisibleBy: _isDivisibleBy2.default, - isHexColor: _isHexColor2.default, - isJSON: _isJSON2.default, - isNull: _isNull2.default, - isLength: _isLength2.default, isByteLength: _isByteLength2.default, - isUUID: _isUUID2.default, isMongoId: _isMongoId2.default, - isDate: _isDate2.default, isAfter: _isAfter2.default, isBefore: _isBefore2.default, - isIn: _isIn2.default, - isCreditCard: _isCreditCard2.default, - isISIN: _isISIN2.default, isISBN: _isISBN2.default, - isMobilePhone: _isMobilePhone2.default, - isCurrency: _isCurrency2.default, - isISO8601: _isISO2.default, - isBase64: _isBase2.default, isDataURI: _isDataURI2.default, - ltrim: _ltrim2.default, rtrim: _rtrim2.default, trim: _trim2.default, - escape: _escape2.default, unescape: _unescape2.default, stripLow: _stripLow2.default, - whitelist: _whitelist2.default, blacklist: _blacklist2.default, - isWhitelisted: _isWhitelisted2.default, - normalizeEmail: _normalizeEmail2.default, - toString: _toString2.default -}; - -exports.default = validator; -module.exports = exports['default']; -},{"./lib/blacklist":109,"./lib/contains":110,"./lib/equals":111,"./lib/escape":112,"./lib/isAfter":113,"./lib/isAlpha":114,"./lib/isAlphanumeric":115,"./lib/isAscii":116,"./lib/isBase64":117,"./lib/isBefore":118,"./lib/isBoolean":119,"./lib/isByteLength":120,"./lib/isCreditCard":121,"./lib/isCurrency":122,"./lib/isDataURI":123,"./lib/isDate":124,"./lib/isDecimal":125,"./lib/isDivisibleBy":126,"./lib/isEmail":127,"./lib/isFQDN":128,"./lib/isFloat":129,"./lib/isFullWidth":130,"./lib/isHalfWidth":131,"./lib/isHexColor":132,"./lib/isHexadecimal":133,"./lib/isIP":134,"./lib/isISBN":135,"./lib/isISIN":136,"./lib/isISO8601":137,"./lib/isIn":138,"./lib/isInt":139,"./lib/isJSON":140,"./lib/isLength":141,"./lib/isLowercase":142,"./lib/isMACAddress":143,"./lib/isMobilePhone":144,"./lib/isMongoId":145,"./lib/isMultibyte":146,"./lib/isNull":147,"./lib/isNumeric":148,"./lib/isSurrogatePair":149,"./lib/isURL":150,"./lib/isUUID":151,"./lib/isUppercase":152,"./lib/isVariableWidth":153,"./lib/isWhitelisted":154,"./lib/ltrim":155,"./lib/matches":156,"./lib/normalizeEmail":157,"./lib/rtrim":158,"./lib/stripLow":159,"./lib/toBoolean":160,"./lib/toDate":161,"./lib/toFloat":162,"./lib/toInt":163,"./lib/trim":164,"./lib/unescape":165,"./lib/util/toString":168,"./lib/whitelist":169}],108:[function(require,module,exports){ 'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -var alpha = exports.alpha = { - 'en-US': /^[A-Z]+$/i, - 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, - 'de-DE': /^[A-ZÄÖÜß]+$/i, - 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i, - 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, - 'nl-NL': /^[A-ZÉËÏÓÖÜ]+$/i, - 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i, - 'pt-PT': /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i, - 'ru-RU': /^[А-ЯЁа-яё]+$/i, - 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, - ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ -}; - -var alphanumeric = exports.alphanumeric = { - 'en-US': /^[0-9A-Z]+$/i, - 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, - 'de-DE': /^[0-9A-ZÄÖÜß]+$/i, - 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i, - 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, - 'nl-NL': /^[0-9A-ZÉËÏÓÖÜ]+$/i, - 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i, - 'pt-PT': /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i, - 'ru-RU': /^[0-9А-ЯЁа-яё]+$/i, - 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i, - ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ -}; - -var englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM']; +var punycode = require('punycode'); +var util = require('./util'); -for (var locale, i = 0; i < englishLocales.length; i++) { - locale = 'en-' + englishLocales[i]; - alpha[locale] = alpha['en-US']; - alphanumeric[locale] = alphanumeric['en-US']; -} +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; -// Source: http://www.localeplanet.com/java/ -var arabicLocales = exports.arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE']; +exports.Url = Url; -for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { - _locale = 'ar-' + arabicLocales[_i]; - alpha[_locale] = alpha.ar; - alphanumeric[_locale] = alphanumeric.ar; +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; } -},{}],109:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = blacklist; -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function blacklist(str, chars) { - (0, _assertString2.default)(str); - return str.replace(new RegExp('[' + chars + ']+', 'g'), ''); -} -module.exports = exports['default']; -},{"./util/assertString":166}],110:[function(require,module,exports){ -'use strict'; +// Reference: RFC 3986, RFC 1808, RFC 2396 -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = contains; +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, -var _assertString = require('./util/assertString'); + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, -var _assertString2 = _interopRequireDefault(_assertString); + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], -var _toString = require('./util/toString'); + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), -var _toString2 = _interopRequireDefault(_toString); + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; -function contains(str, elem) { - (0, _assertString2.default)(str); - return str.indexOf((0, _toString2.default)(elem)) >= 0; + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; } -module.exports = exports['default']; -},{"./util/assertString":166,"./util/toString":168}],111:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = equals; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); -function equals(str, comparison) { - (0, _assertString2.default)(str); - return str === comparison; -} -module.exports = exports['default']; -},{"./util/assertString":166}],112:[function(require,module,exports){ -'use strict'; + var rest = url; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = escape; + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); -var _assertString = require('./util/assertString'); + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } -var _assertString2 = _interopRequireDefault(_assertString); + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } -function escape(str) { - (0, _assertString2.default)(str); - return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(//g, '>').replace(/\//g, '/').replace(/\`/g, '`'); -} -module.exports = exports['default']; -},{"./util/assertString":166}],113:[function(require,module,exports){ -'use strict'; + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isAfter; + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c -var _assertString = require('./util/assertString'); + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. -var _assertString2 = _interopRequireDefault(_assertString); + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } -var _toDate = require('./toDate'); + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } -var _toDate2 = _interopRequireDefault(_toDate); + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; -function isAfter(str) { - var date = arguments.length <= 1 || arguments[1] === undefined ? String(new Date()) : arguments[1]; + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); - (0, _assertString2.default)(str); - var comparison = (0, _toDate2.default)(date); - var original = (0, _toDate2.default)(str); - return !!(original && comparison && original > comparison); -} -module.exports = exports['default']; -},{"./toDate":161,"./util/assertString":166}],114:[function(require,module,exports){ -'use strict'; + // pull out port. + this.parseHost(); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isAlpha; + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; -var _assertString = require('./util/assertString'); + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; -var _assertString2 = _interopRequireDefault(_assertString); + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } -var _alpha = require('./alpha'); + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } -function isAlpha(str) { - var locale = arguments.length <= 1 || arguments[1] === undefined ? 'en-US' : arguments[1]; + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; - (0, _assertString2.default)(str); - if (locale in _alpha.alpha) { - return _alpha.alpha[locale].test(str); + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } } - throw new Error('Invalid locale \'' + locale + '\''); -} -module.exports = exports['default']; -},{"./alpha":108,"./util/assertString":166}],115:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isAlphanumeric; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); -var _alpha = require('./alpha'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isAlphanumeric(str) { - var locale = arguments.length <= 1 || arguments[1] === undefined ? 'en-US' : arguments[1]; + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { - (0, _assertString2.default)(str); - if (locale in _alpha.alphanumeric) { - return _alpha.alphanumeric[locale].test(str); + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } } - throw new Error('Invalid locale \'' + locale + '\''); -} -module.exports = exports['default']; -},{"./alpha":108,"./util/assertString":166}],116:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isAscii; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } -var ascii = /^[\x00-\x7F]+$/; + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; -function isAscii(str) { - (0, _assertString2.default)(str); - return ascii.test(str); +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); } -module.exports = exports['default']; -},{"./util/assertString":166}],117:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isBase64; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } -var notBase64 = /[^A-Z0-9+\/=]/i; + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; -function isBase64(str) { - (0, _assertString2.default)(str); - var len = str.length; - if (!len || len % 4 !== 0 || notBase64.test(str)) { - return false; + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } } - var firstPaddingChar = str.indexOf('='); - return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '='; -} -module.exports = exports['default']; -},{"./util/assertString":166}],118:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isBefore; + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } -var _assertString = require('./util/assertString'); + var search = this.search || (query && ('?' + query)) || ''; -var _assertString2 = _interopRequireDefault(_assertString); + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; -var _toDate = require('./toDate'); + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } -var _toDate2 = _interopRequireDefault(_toDate); + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); -function isBefore(str) { - var date = arguments.length <= 1 || arguments[1] === undefined ? String(new Date()) : arguments[1]; + return protocol + host + pathname + search + hash; +}; - (0, _assertString2.default)(str); - var comparison = (0, _toDate2.default)(date); - var original = (0, _toDate2.default)(str); - return !!(original && comparison && original < comparison); +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); } -module.exports = exports['default']; -},{"./toDate":161,"./util/assertString":166}],119:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isBoolean; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; -function isBoolean(str) { - (0, _assertString2.default)(str); - return ['true', 'false', '1', '0'].indexOf(str) >= 0; +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); } -module.exports = exports['default']; -},{"./util/assertString":166}],120:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } -exports.default = isByteLength; + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; -var _assertString = require('./util/assertString'); + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } -var _assertString2 = _interopRequireDefault(_assertString); + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } -/* eslint-disable prefer-rest-params */ -function isByteLength(str, options) { - (0, _assertString2.default)(str); - var min = void 0; - var max = void 0; - if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') { - min = options.min || 0; - max = options.max; - } else { - // backwards compatibility: isByteLength(str, min [, max]) - min = arguments[1]; - max = arguments[2]; + result.href = result.format(); + return result; } - var len = encodeURI(str).split(/%..|./).length - 1; - return len >= min && (typeof max === 'undefined' || len <= max); -} -module.exports = exports['default']; -},{"./util/assertString":166}],121:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isCreditCard; -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } -/* eslint-disable max-len */ -var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/; -/* eslint-enable max-len */ + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; -function isCreditCard(str) { - (0, _assertString2.default)(str); - var sanitized = str.replace(/[^0-9]+/g, ''); - if (!creditCard.test(sanitized)) { - return false; - } - var sum = 0; - var digit = void 0; - var tmpNum = void 0; - var shouldDouble = void 0; - for (var i = sanitized.length - 1; i >= 0; i--) { - digit = sanitized.substring(i, i + 1); - tmpNum = parseInt(digit, 10); - if (shouldDouble) { - tmpNum *= 2; - if (tmpNum >= 10) { - sum += tmpNum % 10 + 1; - } else { - sum += tmpNum; + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); } - } else { - sum += tmpNum; + relative.host = null; } - shouldDouble = !shouldDouble; + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); } - return !!(sum % 10 === 0 ? sanitized : false); -} -module.exports = exports['default']; -},{"./util/assertString":166}],122:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isCurrency; - -var _merge = require('./util/merge'); -var _merge2 = _interopRequireDefault(_merge); - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function currencyRegex(options) { - var symbol = '(\\' + options.symbol.replace(/\./g, '\\.') + ')' + (options.require_symbol ? '' : '?'), - negative = '-?', - whole_dollar_amount_without_sep = '[1-9]\\d*', - whole_dollar_amount_with_sep = '[1-9]\\d{0,2}(\\' + options.thousands_separator + '\\d{3})*', - valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep], - whole_dollar_amount = '(' + valid_whole_dollar_amounts.join('|') + ')?', - decimal_amount = '(\\' + options.decimal_separator + '\\d{2})?'; - var pattern = whole_dollar_amount + decimal_amount; - - // default is negative sign before symbol, but there are two other options (besides parens) - if (options.allow_negatives && !options.parens_for_negatives) { - if (options.negative_sign_after_digits) { - pattern += negative; - } else if (options.negative_sign_before_digits) { - pattern = negative + pattern; + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); } + result.href = result.format(); + return result; } - // South African Rand, for example, uses R 123 (space) and R-123 (no space) - if (options.allow_negative_sign_placeholder) { - pattern = '( (?!\\-))?' + pattern; - } else if (options.allow_space_after_symbol) { - pattern = ' ?' + pattern; - } else if (options.allow_space_after_digits) { - pattern += '( (?!$))?'; + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; } - if (options.symbol_after_digits) { - pattern += symbol; - } else { - pattern = symbol + pattern; - } - - if (options.allow_negatives) { - if (options.parens_for_negatives) { - pattern = '(\\(' + pattern + '\\)|' + pattern + ')'; - } else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) { - pattern = negative + pattern; - } - } - - /* eslint-disable prefer-template */ - return new RegExp('^' + - // ensure there's a dollar and/or decimal amount, and that - // it doesn't start with a space or a negative sign followed by a space - '(?!-? )(?=.*\\d)' + pattern + '$'); - /* eslint-enable prefer-template */ -} - -var default_currency_options = { - symbol: '$', - require_symbol: false, - allow_space_after_symbol: false, - symbol_after_digits: false, - allow_negatives: true, - parens_for_negatives: false, - negative_sign_before_digits: false, - negative_sign_after_digits: false, - allow_negative_sign_placeholder: false, - thousands_separator: ',', - decimal_separator: '.', - allow_space_after_digits: false -}; - -function isCurrency(str, options) { - (0, _assertString2.default)(str); - options = (0, _merge2.default)(options, default_currency_options); - return currencyRegex(options).test(str); -} -module.exports = exports['default']; -},{"./util/assertString":166,"./util/merge":167}],123:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isDataURI; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var dataURI = /^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; // eslint-disable-line max-len - -function isDataURI(str) { - (0, _assertString2.default)(str); - return dataURI.test(str); -} -module.exports = exports['default']; -},{"./util/assertString":166}],124:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isDate; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -var _isISO = require('./isISO8601'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); -function getTimezoneOffset(str) { - var iso8601Parts = str.match(_isISO.iso8601); - var timezone = void 0, - sign = void 0, - hours = void 0, - minutes = void 0; - if (!iso8601Parts) { - str = str.toLowerCase(); - timezone = str.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/); - if (!timezone) { - return str.indexOf('gmt') !== -1 ? 0 : null; - } - sign = timezone[1]; - var offset = timezone[2]; - if (offset.length === 3) { - offset = '0' + offset; - } - if (offset.length <= 2) { - hours = 0; - minutes = parseInt(offset, 10); - } else { - hours = parseInt(offset.slice(0, 2), 10); - minutes = parseInt(offset.slice(2, 4), 10); - } - } else { - timezone = iso8601Parts[21]; - if (!timezone) { - // if no hour/minute was provided, the date is GMT - return !iso8601Parts[12] ? 0 : null; - } - if (timezone === 'z' || timezone === 'Z') { - return 0; - } - sign = iso8601Parts[22]; - if (timezone.indexOf(':') !== -1) { - hours = parseInt(iso8601Parts[23], 10); - minutes = parseInt(iso8601Parts[24], 10); - } else { - hours = 0; - minutes = parseInt(iso8601Parts[23], 10); + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; } } - return (hours * 60 + minutes) * (sign === '-' ? 1 : -1); -} -function isDate(str) { - (0, _assertString2.default)(str); - var normalizedDate = new Date(Date.parse(str)); - if (isNaN(normalizedDate)) { - return false; + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } } - // normalizedDate is in the user's timezone. Apply the input - // timezone offset to the date so that the year and day match - // the input - var timezoneOffset = getTimezoneOffset(str); - if (timezoneOffset !== null) { - var timezoneDifference = normalizedDate.getTimezoneOffset() - timezoneOffset; - normalizedDate = new Date(normalizedDate.getTime() + 60000 * timezoneDifference); - } - - var day = String(normalizedDate.getDate()); - var dayOrYear = void 0, - dayOrYearMatches = void 0, - year = void 0; - // check for valid double digits that could be late days - // check for all matches since a string like '12/23' is a valid date - // ignore everything with nearby colons - dayOrYearMatches = str.match(/(^|[^:\d])[23]\d([^:\d]|$)/g); - if (!dayOrYearMatches) { - return true; + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); } - dayOrYear = dayOrYearMatches.map(function (digitString) { - return digitString.match(/\d+/g)[0]; - }).join('/'); - year = String(normalizedDate.getFullYear()).slice(-2); - if (dayOrYear === day || dayOrYear === year) { - return true; - } else if (dayOrYear === '' + day / year || dayOrYear === '' + year / day) { - return true; + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); } - return false; -} -module.exports = exports['default']; -},{"./isISO8601":137,"./util/assertString":166}],125:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isDecimal; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var decimal = /^[-+]?([0-9]+|\.[0-9]+|[0-9]+\.[0-9]+)$/; - -function isDecimal(str) { - (0, _assertString2.default)(str); - return str !== '' && decimal.test(str); -} -module.exports = exports['default']; -},{"./util/assertString":166}],126:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isDivisibleBy; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -var _toFloat = require('./toFloat'); - -var _toFloat2 = _interopRequireDefault(_toFloat); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isDivisibleBy(str, num) { - (0, _assertString2.default)(str); - return (0, _toFloat2.default)(str) % parseInt(num, 10) === 0; -} -module.exports = exports['default']; -},{"./toFloat":162,"./util/assertString":166}],127:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isEmail; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); - -var _merge = require('./util/merge'); - -var _merge2 = _interopRequireDefault(_merge); - -var _isByteLength = require('./isByteLength'); + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); -var _isByteLength2 = _interopRequireDefault(_isByteLength); + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } -var _isFQDN = require('./isFQDN'); + mustEndAbs = mustEndAbs || (result.host && srcPath.length); -var _isFQDN2 = _interopRequireDefault(_isFQDN); + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } -var default_email_options = { - allow_display_name: false, - allow_utf8_local_part: true, - require_tld: true + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; }; -/* eslint-disable max-len */ -var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i; -var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i; -var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i; -var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i; -var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i; -/* eslint-enable max-len */ - -function isEmail(str, options) { - (0, _assertString2.default)(str); - options = (0, _merge2.default)(options, default_email_options); - - if (options.allow_display_name) { - var display_email = str.match(displayName); - if (display_email) { - str = display_email[1]; +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); } + host = host.substr(0, host.length - port.length); } + if (host) this.hostname = host; +}; - var parts = str.split('@'); - var domain = parts.pop(); - var user = parts.join('@'); +},{"./util":101,"punycode":78,"querystring":81}],101:[function(require,module,exports){ +'use strict'; - var lower_domain = domain.toLowerCase(); - if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') { - user = user.replace(/\./g, '').toLowerCase(); +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; } +}; + +},{}],102:[function(require,module,exports){ +(function (global){ + +/** + * Module exports. + */ - if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max: 256 })) { - return false; - } +module.exports = deprecate; - if (!(0, _isFQDN2.default)(domain, { require_tld: options.require_tld })) { - return false; - } +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ - if (user[0] === '"') { - user = user.slice(1, user.length - 1); - return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; } - var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; - - var user_parts = user.split('.'); - for (var i = 0; i < user_parts.length; i++) { - if (!pattern.test(user_parts[i])) { - return false; + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; } + return fn.apply(this, arguments); } - return true; + return deprecated; } -module.exports = exports['default']; -},{"./isByteLength":120,"./isFQDN":128,"./util/assertString":166,"./util/merge":167}],128:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isFDQN; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); -var _merge = require('./util/merge'); - -var _merge2 = _interopRequireDefault(_merge); +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} -var default_fqdn_options = { - require_tld: true, - allow_underscores: false, - allow_trailing_dot: false -}; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -function isFDQN(str, options) { - (0, _assertString2.default)(str); - options = (0, _merge2.default)(options, default_fqdn_options); +},{}],103:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],104:[function(require,module,exports){ +(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - /* Remove the optional trailing dot before checking validity */ - if (options.allow_trailing_dot && str[str.length - 1] === '.') { - str = str.substring(0, str.length - 1); - } - var parts = str.split('.'); - if (options.require_tld) { - var tld = parts.pop(); - if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) { - return false; +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); } + return objects.join(' '); } - for (var part, i = 0; i < parts.length; i++) { - part = parts[i]; - if (options.allow_underscores) { - part = part.replace(/_/g, ''); - } - if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) { - return false; - } - if (/[\uff01-\uff5e]/.test(part)) { - // disallow full-width chars - return false; + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; } - if (part[0] === '-' || part[part.length - 1] === '-') { - return false; + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); } } - return true; -} -module.exports = exports['default']; -},{"./util/assertString":166,"./util/merge":167}],129:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isFloat; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); + return str; +}; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var float = /^(?:[-+]?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/; +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } -function isFloat(str, options) { - (0, _assertString2.default)(str); - options = options || {}; - if (str === '' || str === '.') { - return false; + if (process.noDeprecation === true) { + return fn; } - return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max); -} -module.exports = exports['default']; -},{"./util/assertString":166}],130:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.fullWidth = undefined; -exports.default = isFullWidth; + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } -var _assertString = require('./util/assertString'); + return deprecated; +}; -var _assertString2 = _interopRequireDefault(_assertString); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; -var fullWidth = exports.fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; -function isFullWidth(str) { - (0, _assertString2.default)(str); - return fullWidth.test(str); +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); } -},{"./util/assertString":166}],131:[function(require,module,exports){ -'use strict'; +exports.inspect = inspect; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.halfWidth = undefined; -exports.default = isHalfWidth; -var _assertString = require('./util/assertString'); +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; -var _assertString2 = _interopRequireDefault(_assertString); +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var halfWidth = exports.halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; -function isHalfWidth(str) { - (0, _assertString2.default)(str); - return halfWidth.test(str); + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } } -},{"./util/assertString":166}],132:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isHexColor; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i; -function isHexColor(str) { - (0, _assertString2.default)(str); - return hexcolor.test(str); +function stylizeNoColor(str, styleType) { + return str; } -module.exports = exports['default']; -},{"./util/assertString":166}],133:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isHexadecimal; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function arrayToHash(array) { + var hash = {}; -var hexadecimal = /^[0-9A-F]+$/i; + array.forEach(function(val, idx) { + hash[val] = true; + }); -function isHexadecimal(str) { - (0, _assertString2.default)(str); - return hexadecimal.test(str); + return hash; } -module.exports = exports['default']; -},{"./util/assertString":166}],134:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isIP; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; -var ipv6Block = /^[0-9A-F]{1,4}$/i; - -function isIP(str) { - var version = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - (0, _assertString2.default)(str); - version = String(version); - if (!version) { - return isIP(str, 4) || isIP(str, 6); - } else if (version === '4') { - if (!ipv4Maybe.test(str)) { - return false; - } - var parts = str.split('.').sort(function (a, b) { - return a - b; - }); - return parts[3] <= 255; - } else if (version === '6') { - var blocks = str.split(':'); - var foundOmissionBlock = false; // marker to indicate :: - - // At least some OS accept the last 32 bits of an IPv6 address - // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says - // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses, - // and '::a.b.c.d' is deprecated, but also valid. - var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4); - var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8; - - if (blocks.length > expectedNumberOfBlocks) { - return false; - } - // initial or final :: - if (str === '::') { - return true; - } else if (str.substr(0, 2) === '::') { - blocks.shift(); - blocks.shift(); - foundOmissionBlock = true; - } else if (str.substr(str.length - 2) === '::') { - blocks.pop(); - blocks.pop(); - foundOmissionBlock = true; - } - - for (var i = 0; i < blocks.length; ++i) { - // test for a :: which can not be at the string start/end - // since those cases have been handled above - if (blocks[i] === '' && i > 0 && i < blocks.length - 1) { - if (foundOmissionBlock) { - return false; // multiple :: in address - } - foundOmissionBlock = true; - } else if (foundIPv4TransitionBlock && i === blocks.length - 1) { - // it has been checked before that the last - // block is a valid IPv4 address - } else if (!ipv6Block.test(blocks[i])) { - return false; - } - } - if (foundOmissionBlock) { - return blocks.length >= 1; +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); } - return blocks.length === expectedNumberOfBlocks; + return ret; } - return false; -} -module.exports = exports['default']; -},{"./util/assertString":166}],135:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isISBN; - -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } -var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/; -var isbn13Maybe = /^(?:[0-9]{13})$/; -var factor = [1, 3]; + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); -function isISBN(str) { - var version = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } - (0, _assertString2.default)(str); - version = String(version); - if (!version) { - return isISBN(str, 10) || isISBN(str, 13); + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); } - var sanitized = str.replace(/[\s-]+/g, ''); - var checksum = 0; - var i = void 0; - if (version === '10') { - if (!isbn10Maybe.test(sanitized)) { - return false; - } - for (i = 0; i < 9; i++) { - checksum += (i + 1) * sanitized.charAt(i); - } - if (sanitized.charAt(9) === 'X') { - checksum += 10 * 10; - } else { - checksum += 10 * sanitized.charAt(9); - } - if (checksum % 11 === 0) { - return !!sanitized; + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); } - } else if (version === '13') { - if (!isbn13Maybe.test(sanitized)) { - return false; + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } - for (i = 0; i < 12; i++) { - checksum += factor[i % 2] * sanitized.charAt(i); + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); } - if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) { - return !!sanitized; + if (isError(value)) { + return formatError(value); } } - return false; -} -module.exports = exports['default']; -},{"./util/assertString":166}],136:[function(require,module,exports){ -'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isISIN; + var base = '', array = false, braces = ['{', '}']; -var _assertString = require('./util/assertString'); + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } -var _assertString2 = _interopRequireDefault(_assertString); + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } -var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } -function isISIN(str) { - (0, _assertString2.default)(str); - if (!isin.test(str)) { - return false; + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); } - var checksumStr = str.replace(/[A-Z]/g, function (character) { - return parseInt(character, 36); - }); + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } - var sum = 0; - var digit = void 0; - var tmpNum = void 0; - var shouldDouble = true; - for (var i = checksumStr.length - 2; i >= 0; i--) { - digit = checksumStr.substring(i, i + 1); - tmpNum = parseInt(digit, 10); - if (shouldDouble) { - tmpNum *= 2; - if (tmpNum >= 10) { - sum += tmpNum + 1; - } else { - sum += tmpNum; - } + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } else { - sum += tmpNum; + return ctx.stylize('[Object]', 'special'); } - shouldDouble = !shouldDouble; } - return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10; -} -module.exports = exports['default']; -},{"./util/assertString":166}],137:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.iso8601 = undefined; - -exports.default = function (str) { - (0, _assertString2.default)(str); - return iso8601.test(str); -}; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* eslint-disable max-len */ -// from http://goo.gl/0ejHHW -var iso8601 = exports.iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; -/* eslint-enable max-len */ -},{"./util/assertString":166}],138:[function(require,module,exports){ -'use strict'; + ctx.seen.push(value); -Object.defineProperty(exports, "__esModule", { - value: true -}); + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + ctx.seen.pop(); -exports.default = isIn; + return reduceToSingleString(output, base, braces); +} -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} -var _toString = require('./util/toString'); -var _toString2 = _interopRequireDefault(_toString); +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function isIn(str, options) { - (0, _assertString2.default)(str); - var i = void 0; - if (Object.prototype.toString.call(options) === '[object Array]') { - var array = []; - for (i in options) { - if ({}.hasOwnProperty.call(options, i)) { - array[i] = (0, _toString2.default)(options[i]); - } +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); } - return array.indexOf(str) >= 0; - } else if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') { - return options.hasOwnProperty(str); - } else if (options && typeof options.indexOf === 'function') { - return options.indexOf(str) >= 0; } - return false; + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; } -module.exports = exports['default']; -},{"./util/assertString":166,"./util/toString":168}],139:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isInt; -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/; +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } -function isInt(str, options) { - (0, _assertString2.default)(str); - options = options || {}; - return int.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max); + return name + ': ' + str; } -module.exports = exports['default']; -},{"./util/assertString":166}],140:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; -exports.default = isJSON; -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } -function isJSON(str) { - (0, _assertString2.default)(str); - try { - var obj = JSON.parse(str); - return !!obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; - } catch (e) {/* ignore */} - return false; + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } -module.exports = exports['default']; -},{"./util/assertString":166}],141:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - -exports.default = isLength; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/* eslint-disable prefer-rest-params */ -function isLength(str, options) { - (0, _assertString2.default)(str); - var min = void 0; - var max = void 0; - if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') { - min = options.min || 0; - max = options.max; - } else { - // backwards compatibility: isLength(str, min [, max]) - min = arguments[1]; - max = arguments[2]; - } - var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; - var len = str.length - surrogatePairs.length; - return len >= min && (typeof max === 'undefined' || len <= max); +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); } -module.exports = exports['default']; -},{"./util/assertString":166}],142:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isLowercase; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +exports.isArray = isArray; -function isLowercase(str) { - (0, _assertString2.default)(str); - return str === str.toLowerCase(); +function isBoolean(arg) { + return typeof arg === 'boolean'; } -module.exports = exports['default']; -},{"./util/assertString":166}],143:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isMACAddress; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; +exports.isBoolean = isBoolean; -function isMACAddress(str) { - (0, _assertString2.default)(str); - return macAddress.test(str); +function isNull(arg) { + return arg === null; } -module.exports = exports['default']; -},{"./util/assertString":166}],144:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isMobilePhone; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* eslint-disable max-len */ -var phones = { - 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, - 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/, - 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, - 'de-DE': /^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, - 'el-GR': /^(\+?30)?(69\d{8})$/, - 'en-AU': /^(\+?61|0)4\d{8}$/, - 'en-GB': /^(\+?44|0)7\d{9}$/, - 'en-HK': /^(\+?852\-?)?[569]\d{3}\-?\d{4}$/, - 'en-IN': /^(\+?91|0)?[789]\d{9}$/, - 'en-NZ': /^(\+?64|0)2\d{7,9}$/, - 'en-ZA': /^(\+?27|0)\d{9}$/, - 'en-ZM': /^(\+?26)?09[567]\d{7}$/, - 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, - 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5)?|50)\s?(\d\s?){4,8}\d$/, - 'fr-FR': /^(\+?33|0)[67]\d{8}$/, - 'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/, - 'nb-NO': /^(\+?47)?[49]\d{7}$/, - 'nn-NO': /^(\+?47)?[49]\d{7}$/, - 'pt-BR': /^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/, - 'pt-PT': /^(\+?351)?9[1236]\d{7}$/, - 'ru-RU': /^(\+?7|8)?9\d{9}$/, - 'tr-TR': /^(\+?90|0)?5\d{9}$/, - 'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/, - 'zh-CN': /^(\+?0?86\-?)?((13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7})$/, - 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/ -}; -/* eslint-enable max-len */ +exports.isNull = isNull; -function isMobilePhone(str, locale) { - (0, _assertString2.default)(str); - if (locale in phones) { - return phones[locale].test(str); - } - return false; +function isNullOrUndefined(arg) { + return arg == null; } -module.exports = exports['default']; -},{"./util/assertString":166}],145:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isMongoId; - -var _assertString = require('./util/assertString'); - -var _assertString2 = _interopRequireDefault(_assertString); - -var _isHexadecimal = require('./isHexadecimal'); - -var _isHexadecimal2 = _interopRequireDefault(_isHexadecimal); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +exports.isNullOrUndefined = isNullOrUndefined; -function isMongoId(str) { - (0, _assertString2.default)(str); - return (0, _isHexadecimal2.default)(str) && str.length === 24; +function isNumber(arg) { + return typeof arg === 'number'; } -module.exports = exports['default']; -},{"./isHexadecimal":133,"./util/assertString":166}],146:[function(require,module,exports){ -'use strict'; +exports.isNumber = isNumber; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isMultibyte; +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; -var _assertString = require('./util/assertString'); +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; -var _assertString2 = _interopRequireDefault(_assertString); +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; -var multibyte = /[^\x00-\x7F]/; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; -function isMultibyte(str) { - (0, _assertString2.default)(str); - return multibyte.test(str); +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; } -module.exports = exports['default']; -},{"./util/assertString":166}],147:[function(require,module,exports){ -'use strict'; +exports.isDate = isDate; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isNull; +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; -var _assertString = require('./util/assertString'); +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; -var _assertString2 = _interopRequireDefault(_assertString); +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +exports.isBuffer = require('./support/isBuffer'); -function isNull(str) { - (0, _assertString2.default)(str); - return str.length === 0; +function objectToString(o) { + return Object.prototype.toString.call(o); } -module.exports = exports['default']; -},{"./util/assertString":166}],148:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isNumeric; -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var numeric = /^[-+]?[0-9]+$/; +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; -function isNumeric(str) { - (0, _assertString2.default)(str); - return numeric.test(str); +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); } -module.exports = exports['default']; -},{"./util/assertString":166}],149:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isSurrogatePair; -var _assertString = require('./util/assertString'); -var _assertString2 = _interopRequireDefault(_assertString); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; -var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/; -function isSurrogatePair(str) { - (0, _assertString2.default)(str); - return surrogatePair.test(str); -} -module.exports = exports['default']; -},{"./util/assertString":166}],150:[function(require,module,exports){ -'use strict'; +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isURL; +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; -var _assertString = require('./util/assertString'); + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; -var _assertString2 = _interopRequireDefault(_assertString); +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} -var _isFQDN = require('./isFQDN'); +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -var _isFQDN2 = _interopRequireDefault(_isFQDN); +},{"./support/isBuffer":103,"_process":77,"inherits":24}],105:[function(require,module,exports){ +/*! + * Copyright (c) 2015 Chris O'Hara + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ -var _isIP = require('./isIP'); +(function (name, definition) { + if (typeof exports !== 'undefined' && typeof module !== 'undefined') { + module.exports = definition(); + } else if (typeof define === 'function' && typeof define.amd === 'object') { + define(definition); + } else if (typeof define === 'function' && typeof define.petal === 'object') { + define(name, [], definition); + } else { + this[name] = definition(); + } +})('validator', function (validator) { -var _isIP2 = _interopRequireDefault(_isIP); + 'use strict'; -var _merge = require('./util/merge'); + validator = { version: '4.4.0' }; -var _merge2 = _interopRequireDefault(_merge); + var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i; + var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i; + var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i; -var default_url_options = { - protocols: ['http', 'https', 'ftp'], - require_tld: true, - require_protocol: false, - require_valid_protocol: true, - allow_underscores: false, - allow_trailing_dot: false, - allow_protocol_relative_urls: false -}; + var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i; -function isURL(url, options) { - (0, _assertString2.default)(url); - if (!url || url.length >= 2083 || /\s/.test(url)) { - return false; - } - if (url.indexOf('mailto:') === 0) { - return false; - } - options = (0, _merge2.default)(options, default_url_options); - var protocol = void 0, - auth = void 0, - host = void 0, - hostname = void 0, - port = void 0, - port_str = void 0, - split = void 0; - - split = url.split('#'); - url = split.shift(); - - split = url.split('?'); - url = split.shift(); - - split = url.split('://'); - if (split.length > 1) { - protocol = split.shift(); - if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) { - return false; - } - } else if (options.require_protocol) { - return false; - } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') { - split[0] = url.substr(2); - } - url = split.join('://'); + var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/; - split = url.split('/'); - url = split.shift(); - split = url.split('@'); - if (split.length > 1) { - auth = split.shift(); - if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) { - return false; - } - } - hostname = split.join('@'); - split = hostname.split(':'); - host = split.shift(); - if (split.length) { - port_str = split.join(':'); - port = parseInt(port_str, 10); - if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) { - return false; - } - } - if (!(0, _isIP2.default)(host) && !(0, _isFQDN2.default)(host, options) && host !== 'localhost') { - return false; - } - if (options.host_whitelist && options.host_whitelist.indexOf(host) === -1) { - return false; - } - if (options.host_blacklist && options.host_blacklist.indexOf(host) !== -1) { - return false; - } - return true; -} -module.exports = exports['default']; -},{"./isFQDN":128,"./isIP":134,"./util/assertString":166,"./util/merge":167}],151:[function(require,module,exports){ -'use strict'; + var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isUUID; + var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/ + , isbn13Maybe = /^(?:[0-9]{13})$/; -var _assertString = require('./util/assertString'); + var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; -var _assertString2 = _interopRequireDefault(_assertString); + var ipv4Maybe = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ + , ipv6Block = /^[0-9A-F]{1,4}$/i; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var uuid = { + '3': /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i + , '4': /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i + , '5': /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i + , all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i + }; -var uuid = { - 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, - 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, - 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, - all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i -}; + var alpha = /^[A-Z]+$/i + , alphanumeric = /^[0-9A-Z]+$/i + , numeric = /^[-+]?[0-9]+$/ + , int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/ + , float = /^(?:[-+]?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/ + , hexadecimal = /^[0-9A-F]+$/i + , decimal = /^[-+]?([0-9]+|\.[0-9]+|[0-9]+\.[0-9]+)$/ + , hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i; + + var ascii = /^[\x00-\x7F]+$/ + , multibyte = /[^\x00-\x7F]/ + , fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/ + , halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; + + var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/; + + var base64 = /^(?:[A-Z0-9+\/]{4})*(?:[A-Z0-9+\/]{2}==|[A-Z0-9+\/]{3}=|[A-Z0-9+\/]{4})$/i; + + var phones = { + 'zh-CN': /^(\+?0?86\-?)?1[345789]\d{9}$/, + 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/, + 'en-ZA': /^(\+?27|0)\d{9}$/, + 'en-AU': /^(\+?61|0)4\d{8}$/, + 'en-HK': /^(\+?852\-?)?[569]\d{3}\-?\d{4}$/, + 'fr-FR': /^(\+?33|0)[67]\d{8}$/, + 'pt-PT': /^(\+351)?9[1236]\d{7}$/, + 'el-GR': /^(\+30)?((2\d{9})|(69\d{8}))$/, + 'en-GB': /^(\+?44|0)7\d{9}$/, + 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/, + 'en-ZM': /^(\+26)?09[567]\d{7}$/, + 'ru-RU': /^(\+?7|8)?9\d{9}$/, + 'nb-NO': /^(\+?47)?[49]\d{7}$/, + 'nn-NO': /^(\+?47)?[49]\d{7}$/, + 'vi-VN': /^(0|\+?84)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/, + 'en-NZ': /^(\+?64|0)2\d{7,9}$/ + }; -function isUUID(str) { - var version = arguments.length <= 1 || arguments[1] === undefined ? 'all' : arguments[1]; + // from http://goo.gl/0ejHHW + var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; - (0, _assertString2.default)(str); - var pattern = uuid[version]; - return pattern && pattern.test(str); -} -module.exports = exports['default']; -},{"./util/assertString":166}],152:[function(require,module,exports){ -'use strict'; + validator.extend = function (name, fn) { + validator[name] = function () { + var args = Array.prototype.slice.call(arguments); + args[0] = validator.toString(args[0]); + return fn.apply(validator, args); + }; + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isUppercase; + //Right before exporting the validator object, pass each of the builtins + //through extend() so that their first argument is coerced to a string + validator.init = function () { + for (var name in validator) { + if (typeof validator[name] !== 'function' || name === 'toString' || + name === 'toDate' || name === 'extend' || name === 'init') { + continue; + } + validator.extend(name, validator[name]); + } + }; -var _assertString = require('./util/assertString'); + validator.toString = function (input) { + if (typeof input === 'object' && input !== null && input.toString) { + input = input.toString(); + } else if (input === null || typeof input === 'undefined' || (isNaN(input) && !input.length)) { + input = ''; + } + return '' + input; + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.toDate = function (date) { + if (Object.prototype.toString.call(date) === '[object Date]') { + return date; + } + date = Date.parse(date); + return !isNaN(date) ? new Date(date) : null; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.toFloat = function (str) { + return parseFloat(str); + }; -function isUppercase(str) { - (0, _assertString2.default)(str); - return str === str.toUpperCase(); -} -module.exports = exports['default']; -},{"./util/assertString":166}],153:[function(require,module,exports){ -'use strict'; + validator.toInt = function (str, radix) { + return parseInt(str, radix || 10); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isVariableWidth; + validator.toBoolean = function (str, strict) { + if (strict) { + return str === '1' || str === 'true'; + } + return str !== '0' && str !== 'false' && str !== ''; + }; -var _assertString = require('./util/assertString'); + validator.equals = function (str, comparison) { + return str === validator.toString(comparison); + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.contains = function (str, elem) { + return str.indexOf(validator.toString(elem)) >= 0; + }; -var _isFullWidth = require('./isFullWidth'); + validator.matches = function (str, pattern, modifiers) { + if (Object.prototype.toString.call(pattern) !== '[object RegExp]') { + pattern = new RegExp(pattern, modifiers); + } + return pattern.test(str); + }; -var _isHalfWidth = require('./isHalfWidth'); + var default_email_options = { + allow_display_name: false, + allow_utf8_local_part: true, + require_tld: true + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isEmail = function (str, options) { + options = merge(options, default_email_options); -function isVariableWidth(str) { - (0, _assertString2.default)(str); - return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str); -} -module.exports = exports['default']; -},{"./isFullWidth":130,"./isHalfWidth":131,"./util/assertString":166}],154:[function(require,module,exports){ -'use strict'; + if (options.allow_display_name) { + var display_email = str.match(displayName); + if (display_email) { + str = display_email[1]; + } + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isWhitelisted; + var parts = str.split('@') + , domain = parts.pop() + , user = parts.join('@'); -var _assertString = require('./util/assertString'); + var lower_domain = domain.toLowerCase(); + if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') { + user = user.replace(/\./g, '').toLowerCase(); + } -var _assertString2 = _interopRequireDefault(_assertString); + if (!validator.isByteLength(user, 0, 64) || + !validator.isByteLength(domain, 0, 256)) { + return false; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (!validator.isFQDN(domain, {require_tld: options.require_tld})) { + return false; + } -function isWhitelisted(str, chars) { - (0, _assertString2.default)(str); - for (var i = str.length - 1; i >= 0; i--) { - if (chars.indexOf(str[i]) === -1) { - return false; - } - } - return true; -} -module.exports = exports['default']; -},{"./util/assertString":166}],155:[function(require,module,exports){ -'use strict'; + if (user[0] === '"') { + user = user.slice(1, user.length - 1); + return options.allow_utf8_local_part ? + quotedEmailUserUtf8.test(user) : + quotedEmailUser.test(user); + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = ltrim; + var pattern = options.allow_utf8_local_part ? + emailUserUtf8Part : emailUserPart; -var _assertString = require('./util/assertString'); + var user_parts = user.split('.'); + for (var i = 0; i < user_parts.length; i++) { + if (!pattern.test(user_parts[i])) { + return false; + } + } -var _assertString2 = _interopRequireDefault(_assertString); + return true; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var default_url_options = { + protocols: [ 'http', 'https', 'ftp' ] + , require_tld: true + , require_protocol: false + , require_valid_protocol: true + , allow_underscores: false + , allow_trailing_dot: false + , allow_protocol_relative_urls: false + }; -function ltrim(str, chars) { - (0, _assertString2.default)(str); - var pattern = chars ? new RegExp('^[' + chars + ']+', 'g') : /^\s+/g; - return str.replace(pattern, ''); -} -module.exports = exports['default']; -},{"./util/assertString":166}],156:[function(require,module,exports){ -'use strict'; + validator.isURL = function (url, options) { + if (!url || url.length >= 2083 || /\s/.test(url)) { + return false; + } + if (url.indexOf('mailto:') === 0) { + return false; + } + options = merge(options, default_url_options); + var protocol, auth, host, hostname, port, + port_str, split; + split = url.split('://'); + if (split.length > 1) { + protocol = split.shift(); + if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) { + return false; + } + } else if (options.require_protocol) { + return false; + } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') { + split[0] = url.substr(2); + } + url = split.join('://'); + split = url.split('#'); + url = split.shift(); + + split = url.split('?'); + url = split.shift(); + + split = url.split('/'); + url = split.shift(); + split = url.split('@'); + if (split.length > 1) { + auth = split.shift(); + if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) { + return false; + } + } + hostname = split.join('@'); + split = hostname.split(':'); + host = split.shift(); + if (split.length) { + port_str = split.join(':'); + port = parseInt(port_str, 10); + if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) { + return false; + } + } + if (!validator.isIP(host) && !validator.isFQDN(host, options) && + host !== 'localhost') { + return false; + } + if (options.host_whitelist && + options.host_whitelist.indexOf(host) === -1) { + return false; + } + if (options.host_blacklist && + options.host_blacklist.indexOf(host) !== -1) { + return false; + } + return true; + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = matches; + validator.isMACAddress = function (str) { + return macAddress.test(str); + }; -var _assertString = require('./util/assertString'); + validator.isIP = function (str, version) { + version = validator.toString(version); + if (!version) { + return validator.isIP(str, 4) || validator.isIP(str, 6); + } else if (version === '4') { + if (!ipv4Maybe.test(str)) { + return false; + } + var parts = str.split('.').sort(function (a, b) { + return a - b; + }); + return parts[3] <= 255; + } else if (version === '6') { + var blocks = str.split(':'); + var foundOmissionBlock = false; // marker to indicate :: + + // At least some OS accept the last 32 bits of an IPv6 address + // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says + // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses, + // and '::a.b.c.d' is deprecated, but also valid. + var foundIPv4TransitionBlock = validator.isIP(blocks[blocks.length - 1], 4); + var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8; + + if (blocks.length > expectedNumberOfBlocks) + return false; -var _assertString2 = _interopRequireDefault(_assertString); + // initial or final :: + if (str === '::') { + return true; + } else if (str.substr(0, 2) === '::') { + blocks.shift(); + blocks.shift(); + foundOmissionBlock = true; + } else if (str.substr(str.length - 2) === '::') { + blocks.pop(); + blocks.pop(); + foundOmissionBlock = true; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + for (var i = 0; i < blocks.length; ++i) { + // test for a :: which can not be at the string start/end + // since those cases have been handled above + if (blocks[i] === '' && i > 0 && i < blocks.length -1) { + if (foundOmissionBlock) + return false; // multiple :: in address + foundOmissionBlock = true; + } else if (foundIPv4TransitionBlock && i == blocks.length - 1) { + // it has been checked before that the last + // block is a valid IPv4 address + } else if (!ipv6Block.test(blocks[i])) { + return false; + } + } -function matches(str, pattern, modifiers) { - (0, _assertString2.default)(str); - if (Object.prototype.toString.call(pattern) !== '[object RegExp]') { - pattern = new RegExp(pattern, modifiers); - } - return pattern.test(str); -} -module.exports = exports['default']; -},{"./util/assertString":166}],157:[function(require,module,exports){ -'use strict'; + if (foundOmissionBlock) { + return blocks.length >= 1; + } else { + return blocks.length === expectedNumberOfBlocks; + } + } + return false; + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = normalizeEmail; + var default_fqdn_options = { + require_tld: true + , allow_underscores: false + , allow_trailing_dot: false + }; -var _isEmail = require('./isEmail'); + validator.isFQDN = function (str, options) { + options = merge(options, default_fqdn_options); -var _isEmail2 = _interopRequireDefault(_isEmail); + /* Remove the optional trailing dot before checking validity */ + if (options.allow_trailing_dot && str[str.length - 1] === '.') { + str = str.substring(0, str.length - 1); + } + var parts = str.split('.'); + if (options.require_tld) { + var tld = parts.pop(); + if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) { + return false; + } + } + for (var part, i = 0; i < parts.length; i++) { + part = parts[i]; + if (options.allow_underscores) { + if (part.indexOf('__') >= 0) { + return false; + } + part = part.replace(/_/g, ''); + } + if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) { + return false; + } + if (/[\uff01-\uff5e]/.test(part)) { + // disallow full-width chars + return false; + } + if (part[0] === '-' || part[part.length - 1] === '-' || + part.indexOf('---') >= 0) { + return false; + } + } + return true; + }; -var _merge = require('./util/merge'); + validator.isBoolean = function(str) { + return (['true', 'false', '1', '0'].indexOf(str) >= 0); + }; -var _merge2 = _interopRequireDefault(_merge); + validator.isAlpha = function (str) { + return alpha.test(str); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isAlphanumeric = function (str) { + return alphanumeric.test(str); + }; -var default_normalize_email_options = { - lowercase: true, - remove_dots: true, - remove_extension: true -}; + validator.isNumeric = function (str) { + return numeric.test(str); + }; -function normalizeEmail(email, options) { - options = (0, _merge2.default)(options, default_normalize_email_options); - if (!(0, _isEmail2.default)(email)) { - return false; - } - var parts = email.split('@', 2); - parts[1] = parts[1].toLowerCase(); - if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') { - if (options.remove_extension) { - parts[0] = parts[0].split('+')[0]; - } - if (options.remove_dots) { - parts[0] = parts[0].replace(/\./g, ''); - } - if (!parts[0].length) { - return false; - } - parts[0] = parts[0].toLowerCase(); - parts[1] = 'gmail.com'; - } else if (options.lowercase) { - parts[0] = parts[0].toLowerCase(); - } - return parts.join('@'); -} -module.exports = exports['default']; -},{"./isEmail":127,"./util/merge":167}],158:[function(require,module,exports){ -'use strict'; + validator.isDecimal = function (str) { + return str !== '' && decimal.test(str); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = rtrim; + validator.isHexadecimal = function (str) { + return hexadecimal.test(str); + }; -var _assertString = require('./util/assertString'); + validator.isHexColor = function (str) { + return hexcolor.test(str); + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isLowercase = function (str) { + return str === str.toLowerCase(); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isUppercase = function (str) { + return str === str.toUpperCase(); + }; -function rtrim(str, chars) { - (0, _assertString2.default)(str); - var pattern = chars ? new RegExp('[' + chars + ']+$', 'g') : /\s+$/g; - return str.replace(pattern, ''); -} -module.exports = exports['default']; -},{"./util/assertString":166}],159:[function(require,module,exports){ -'use strict'; + validator.isInt = function (str, options) { + options = options || {}; + return int.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = stripLow; + validator.isFloat = function (str, options) { + options = options || {}; + if (str === '' || str === '.') { + return false; + } + return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max); + }; -var _assertString = require('./util/assertString'); + validator.isDivisibleBy = function (str, num) { + return validator.toFloat(str) % validator.toInt(num) === 0; + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isNull = function (str) { + return str.length === 0; + }; -var _blacklist = require('./blacklist'); + validator.isLength = function (str, min, max) { + var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; + var len = str.length - surrogatePairs.length; + return len >= min && (typeof max === 'undefined' || len <= max); + }; -var _blacklist2 = _interopRequireDefault(_blacklist); + validator.isByteLength = function (str, min, max) { + var len = encodeURI(str).split(/%..|./).length - 1; + return len >= min && (typeof max === 'undefined' || len <= max); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isUUID = function (str, version) { + var pattern = uuid[version ? version : 'all']; + return pattern && pattern.test(str); + }; -function stripLow(str, keep_new_lines) { - (0, _assertString2.default)(str); - var chars = keep_new_lines ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F'; - return (0, _blacklist2.default)(str, chars); -} -module.exports = exports['default']; -},{"./blacklist":109,"./util/assertString":166}],160:[function(require,module,exports){ -'use strict'; + function getTimezoneOffset(str) { + var iso8601Parts = str.match(iso8601) + , timezone, sign, hours, minutes; + if (!iso8601Parts) { + str = str.toLowerCase(); + timezone = str.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/); + if (!timezone) { + return str.indexOf('gmt') !== -1 ? 0 : null; + } + sign = timezone[1]; + var offset = timezone[2]; + if (offset.length === 3) { + offset = '0' + offset; + } + if (offset.length <= 2) { + hours = 0; + minutes = parseInt(offset); + } else { + hours = parseInt(offset.slice(0, 2)); + minutes = parseInt(offset.slice(2, 4)); + } + } else { + timezone = iso8601Parts[21]; + if (!timezone || timezone === 'z' || timezone === 'Z') { + return 0; + } + sign = iso8601Parts[22]; + if (timezone.indexOf(':') !== -1) { + hours = parseInt(iso8601Parts[23]); + minutes = parseInt(iso8601Parts[24]); + } else { + hours = 0; + minutes = parseInt(iso8601Parts[23]); + } + } + return (hours * 60 + minutes) * (sign === '-' ? 1 : -1); + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = toBoolean; + validator.isDate = function (str) { + var normalizedDate = new Date(Date.parse(str)); + if (isNaN(normalizedDate)) { + return false; + } + // normalizedDate is in the user's timezone. Apply the input + // timezone offset to the date so that the year and day match + // the input + var timezoneOffset = getTimezoneOffset(str); + if (timezoneOffset !== null) { + var timezoneDifference = normalizedDate.getTimezoneOffset() - + timezoneOffset; + normalizedDate = new Date(normalizedDate.getTime() + + 60000 * timezoneDifference); + } + var day = String(normalizedDate.getDate()); + var dayOrYear, dayOrYearMatches, year; + //check for valid double digits that could be late days + //check for all matches since a string like '12/23' is a valid date + //ignore everything with nearby colons + dayOrYearMatches = str.match(/(^|[^:\d])[23]\d([^:\d]|$)/g); + if (!dayOrYearMatches) { + return true; + } + dayOrYear = dayOrYearMatches.map(function(digitString) { + return digitString.match(/\d+/g)[0]; + }).join('/'); + year = String(normalizedDate.getFullYear()).slice(-2); + if (dayOrYear === day || dayOrYear === year) { + return true; + } else if ((dayOrYear === (day + '/' + year)) || (dayOrYear === (year + '/' + day))) { + return true; + } + return false; + }; -var _assertString = require('./util/assertString'); + validator.isAfter = function (str, date) { + var comparison = validator.toDate(date || new Date()) + , original = validator.toDate(str); + return !!(original && comparison && original > comparison); + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isBefore = function (str, date) { + var comparison = validator.toDate(date || new Date()) + , original = validator.toDate(str); + return !!(original && comparison && original < comparison); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isIn = function (str, options) { + var i; + if (Object.prototype.toString.call(options) === '[object Array]') { + var array = []; + for (i in options) { + array[i] = validator.toString(options[i]); + } + return array.indexOf(str) >= 0; + } else if (typeof options === 'object') { + return options.hasOwnProperty(str); + } else if (options && typeof options.indexOf === 'function') { + return options.indexOf(str) >= 0; + } + return false; + }; -function toBoolean(str, strict) { - (0, _assertString2.default)(str); - if (strict) { - return str === '1' || str === 'true'; - } - return str !== '0' && str !== 'false' && str !== ''; -} -module.exports = exports['default']; -},{"./util/assertString":166}],161:[function(require,module,exports){ -'use strict'; + validator.isWhitelisted = function (str, chars) { + for (var i = str.length - 1; i >= 0; i--) { + if (chars.indexOf(str[i]) === -1) { + return false; + } + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = toDate; + return true; + }; -var _assertString = require('./util/assertString'); + validator.isCreditCard = function (str) { + var sanitized = str.replace(/[^0-9]+/g, ''); + if (!creditCard.test(sanitized)) { + return false; + } + var sum = 0, digit, tmpNum, shouldDouble; + for (var i = sanitized.length - 1; i >= 0; i--) { + digit = sanitized.substring(i, (i + 1)); + tmpNum = parseInt(digit, 10); + if (shouldDouble) { + tmpNum *= 2; + if (tmpNum >= 10) { + sum += ((tmpNum % 10) + 1); + } else { + sum += tmpNum; + } + } else { + sum += tmpNum; + } + shouldDouble = !shouldDouble; + } + return !!((sum % 10) === 0 ? sanitized : false); + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isISIN = function (str) { + if (!isin.test(str)) { + return false; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var checksumStr = str.replace(/[A-Z]/g, function(character) { + return parseInt(character, 36); + }); -function toDate(date) { - (0, _assertString2.default)(date); - date = Date.parse(date); - return !isNaN(date) ? new Date(date) : null; -} -module.exports = exports['default']; -},{"./util/assertString":166}],162:[function(require,module,exports){ -'use strict'; + var sum = 0, digit, tmpNum, shouldDouble = true; + for (var i = checksumStr.length - 2; i >= 0; i--) { + digit = checksumStr.substring(i, (i + 1)); + tmpNum = parseInt(digit, 10); + if (shouldDouble) { + tmpNum *= 2; + if (tmpNum >= 10) { + sum += tmpNum + 1; + } else { + sum += tmpNum; + } + } else { + sum += tmpNum; + } + shouldDouble = !shouldDouble; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = toFloat; + return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10; + }; -var _assertString = require('./util/assertString'); + validator.isISBN = function (str, version) { + version = validator.toString(version); + if (!version) { + return validator.isISBN(str, 10) || validator.isISBN(str, 13); + } + var sanitized = str.replace(/[\s-]+/g, '') + , checksum = 0, i; + if (version === '10') { + if (!isbn10Maybe.test(sanitized)) { + return false; + } + for (i = 0; i < 9; i++) { + checksum += (i + 1) * sanitized.charAt(i); + } + if (sanitized.charAt(9) === 'X') { + checksum += 10 * 10; + } else { + checksum += 10 * sanitized.charAt(9); + } + if ((checksum % 11) === 0) { + return !!sanitized; + } + } else if (version === '13') { + if (!isbn13Maybe.test(sanitized)) { + return false; + } + var factor = [ 1, 3 ]; + for (i = 0; i < 12; i++) { + checksum += factor[i % 2] * sanitized.charAt(i); + } + if (sanitized.charAt(12) - ((10 - (checksum % 10)) % 10) === 0) { + return !!sanitized; + } + } + return false; + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isMobilePhone = function(str, locale) { + if (locale in phones) { + return phones[locale].test(str); + } + return false; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var default_currency_options = { + symbol: '$' + , require_symbol: false + , allow_space_after_symbol: false + , symbol_after_digits: false + , allow_negatives: true + , parens_for_negatives: false + , negative_sign_before_digits: false + , negative_sign_after_digits: false + , allow_negative_sign_placeholder: false + , thousands_separator: ',' + , decimal_separator: '.' + , allow_space_after_digits: false + }; -function toFloat(str) { - (0, _assertString2.default)(str); - return parseFloat(str); -} -module.exports = exports['default']; -},{"./util/assertString":166}],163:[function(require,module,exports){ -'use strict'; + validator.isCurrency = function (str, options) { + options = merge(options, default_currency_options); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = toInt; + return currencyRegex(options).test(str); + }; -var _assertString = require('./util/assertString'); + validator.isJSON = function (str) { + try { + var obj = JSON.parse(str); + return !!obj && typeof obj === 'object'; + } catch (e) {} + return false; + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isMultibyte = function (str) { + return multibyte.test(str); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isAscii = function (str) { + return ascii.test(str); + }; -function toInt(str, radix) { - (0, _assertString2.default)(str); - return parseInt(str, radix || 10); -} -module.exports = exports['default']; -},{"./util/assertString":166}],164:[function(require,module,exports){ -'use strict'; + validator.isFullWidth = function (str) { + return fullWidth.test(str); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = trim; + validator.isHalfWidth = function (str) { + return halfWidth.test(str); + }; -var _assertString = require('./util/assertString'); + validator.isVariableWidth = function (str) { + return fullWidth.test(str) && halfWidth.test(str); + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.isSurrogatePair = function (str) { + return surrogatePair.test(str); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.isBase64 = function (str) { + return base64.test(str); + }; -function trim(str, chars) { - (0, _assertString2.default)(str); - var pattern = chars ? new RegExp('^[' + chars + ']+|[' + chars + ']+$', 'g') : /^\s+|\s+$/g; - return str.replace(pattern, ''); -} -module.exports = exports['default']; -},{"./util/assertString":166}],165:[function(require,module,exports){ -'use strict'; + validator.isMongoId = function (str) { + return validator.isHexadecimal(str) && str.length === 24; + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = unescape; + validator.isISO8601 = function (str) { + return iso8601.test(str); + }; -var _assertString = require('./util/assertString'); + validator.ltrim = function (str, chars) { + var pattern = chars ? new RegExp('^[' + chars + ']+', 'g') : /^\s+/g; + return str.replace(pattern, ''); + }; -var _assertString2 = _interopRequireDefault(_assertString); + validator.rtrim = function (str, chars) { + var pattern = chars ? new RegExp('[' + chars + ']+$', 'g') : /\s+$/g; + return str.replace(pattern, ''); + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + validator.trim = function (str, chars) { + var pattern = chars ? new RegExp('^[' + chars + ']+|[' + chars + ']+$', 'g') : /^\s+|\s+$/g; + return str.replace(pattern, ''); + }; -function unescape(str) { - (0, _assertString2.default)(str); - return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '\/').replace(/`/g, '\`'); -} -module.exports = exports['default']; -},{"./util/assertString":166}],166:[function(require,module,exports){ -'use strict'; + validator.escape = function (str) { + return (str.replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(//g, '>') + .replace(/\//g, '/') + .replace(/\`/g, '`')); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = assertString; -function assertString(input) { - if (typeof input !== 'string') { - throw new TypeError('This library (validator.js) validates strings only'); - } -} -module.exports = exports['default']; -},{}],167:[function(require,module,exports){ -'use strict'; + validator.stripLow = function (str, keep_new_lines) { + var chars = keep_new_lines ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F'; + return validator.blacklist(str, chars); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = merge; -function merge() { - var obj = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - var defaults = arguments[1]; + validator.whitelist = function (str, chars) { + return str.replace(new RegExp('[^' + chars + ']+', 'g'), ''); + }; - for (var key in defaults) { - if (typeof obj[key] === 'undefined') { - obj[key] = defaults[key]; - } - } - return obj; -} -module.exports = exports['default']; -},{}],168:[function(require,module,exports){ -'use strict'; + validator.blacklist = function (str, chars) { + return str.replace(new RegExp('[' + chars + ']+', 'g'), ''); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); + var default_normalize_email_options = { + lowercase: true, + remove_dots: true, + remove_extension: true + }; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + validator.normalizeEmail = function (email, options) { + options = merge(options, default_normalize_email_options); + if (!validator.isEmail(email)) { + return false; + } + var parts = email.split('@', 2); + parts[1] = parts[1].toLowerCase(); + if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') { + if (options.remove_extension) { + parts[0] = parts[0].split('+')[0]; + } + if (options.remove_dots) { + parts[0] = parts[0].replace(/\./g, ''); + } + if (!parts[0].length) { + return false; + } + parts[0] = parts[0].toLowerCase(); + parts[1] = 'gmail.com'; + } else if (options.lowercase) { + parts[0] = parts[0].toLowerCase(); + } + return parts.join('@'); + }; -exports.default = toString; -function toString(input) { - if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && input !== null) { - if (typeof input.toString === 'function') { - input = input.toString(); - } else { - input = '[object Object]'; + function merge(obj, defaults) { + obj = obj || {}; + for (var key in defaults) { + if (typeof obj[key] === 'undefined') { + obj[key] = defaults[key]; + } + } + return obj; + } + + function currencyRegex(options) { + var symbol = '(\\' + options.symbol.replace(/\./g, '\\.') + ')' + (options.require_symbol ? '' : '?') + , negative = '-?' + , whole_dollar_amount_without_sep = '[1-9]\\d*' + , whole_dollar_amount_with_sep = '[1-9]\\d{0,2}(\\' + options.thousands_separator + '\\d{3})*' + , valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep] + , whole_dollar_amount = '(' + valid_whole_dollar_amounts.join('|') + ')?' + , decimal_amount = '(\\' + options.decimal_separator + '\\d{2})?'; + var pattern = whole_dollar_amount + decimal_amount; + // default is negative sign before symbol, but there are two other options (besides parens) + if (options.allow_negatives && !options.parens_for_negatives) { + if (options.negative_sign_after_digits) { + pattern += negative; + } + else if (options.negative_sign_before_digits) { + pattern = negative + pattern; + } + } + // South African Rand, for example, uses R 123 (space) and R-123 (no space) + if (options.allow_negative_sign_placeholder) { + pattern = '( (?!\\-))?' + pattern; + } + else if (options.allow_space_after_symbol) { + pattern = ' ?' + pattern; + } + else if (options.allow_space_after_digits) { + pattern += '( (?!$))?'; + } + if (options.symbol_after_digits) { + pattern += symbol; + } else { + pattern = symbol + pattern; + } + if (options.allow_negatives) { + if (options.parens_for_negatives) { + pattern = '(\\(' + pattern + '\\)|' + pattern + ')'; + } + else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) { + pattern = negative + pattern; + } + } + return new RegExp( + '^' + + // ensure there's a dollar and/or decimal amount, and that it doesn't start with a space or a negative sign followed by a space + '(?!-? )(?=.*\\d)' + + pattern + + '$' + ); } - } else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) { - input = ''; - } - return String(input); -} -module.exports = exports['default']; -},{}],169:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = whitelist; -var _assertString = require('./util/assertString'); + validator.init(); -var _assertString2 = _interopRequireDefault(_assertString); + return validator; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +}); -function whitelist(str, chars) { - (0, _assertString2.default)(str); - return str.replace(new RegExp('[^' + chars + ']+', 'g'), ''); -} -module.exports = exports['default']; -},{"./util/assertString":166}],170:[function(require,module,exports){ +},{}],106:[function(require,module,exports){ module.exports = extend var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -20841,7 +24272,7 @@ function extend() { return target } -},{}],171:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ "use strict"; module.exports = { @@ -20902,7 +24333,7 @@ module.exports = { }; -},{}],172:[function(require,module,exports){ +},{}],108:[function(require,module,exports){ /*jshint maxlen: false*/ var validator = require("validator"); @@ -21033,7 +24464,7 @@ var FormatValidators = { module.exports = FormatValidators; -},{"validator":107}],173:[function(require,module,exports){ +},{"validator":105}],109:[function(require,module,exports){ "use strict"; var FormatValidators = require("./FormatValidators"), @@ -21562,10 +24993,6 @@ exports.validate = function (report, schema, json) { } } - if (typeof this.options.customValidator === "function") { - this.options.customValidator(report, schema, json); - } - // we don't need the root pointer anymore if (isRoot) { report.rootSchema = undefined; @@ -21576,7 +25003,7 @@ exports.validate = function (report, schema, json) { }; -},{"./FormatValidators":172,"./Report":175,"./Utils":179}],174:[function(require,module,exports){ +},{"./FormatValidators":108,"./Report":111,"./Utils":115}],110:[function(require,module,exports){ // Number.isFinite polyfill // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite if (typeof Number.isFinite !== "function") { @@ -21594,7 +25021,7 @@ if (typeof Number.isFinite !== "function") { }; } -},{}],175:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ (function (process){ "use strict"; @@ -21675,14 +25102,14 @@ Report.prototype.processAsyncTasks = function (timeout, callback) { }; -Report.prototype.getPath = function (returnPathAsString) { +Report.prototype.getPath = function () { var path = []; if (this.parentReport) { path = path.concat(this.parentReport.path); } path = path.concat(this.path); - if (returnPathAsString !== true) { + if (this.options.reportPathAsArray !== true) { // Sanitize the path segments (http://tools.ietf.org/html/rfc6901#section-4) path = "#/" + path.map(function (segment) { @@ -21743,21 +25170,17 @@ Report.prototype.hasError = function (errorCode, params) { }; Report.prototype.addError = function (errorCode, params, subReports, schemaDescription) { - if (!errorCode) { throw new Error("No errorCode passed into addError()"); } - - this.addCustomError(errorCode, Errors[errorCode], params, subReports, schemaDescription); -}; - -Report.prototype.addCustomError = function (errorCode, errorMessage, params, subReports, schemaDescription) { if (this.errors.length >= this.reportOptions.maxErrors) { return; } - if (!errorMessage) { throw new Error("No errorMessage known for code " + errorCode); } + if (!errorCode) { throw new Error("No errorCode passed into addError()"); } + if (!Errors[errorCode]) { throw new Error("No errorMessage known for code " + errorCode); } params = params || []; - var idx = params.length; + var idx = params.length, + errorMessage = Errors[errorCode]; while (idx--) { var whatIs = Utils.whatIs(params[idx]); var param = (whatIs === "object" || whatIs === "null") ? JSON.stringify(params[idx]) : params[idx]; @@ -21768,7 +25191,7 @@ Report.prototype.addCustomError = function (errorCode, errorMessage, params, sub code: errorCode, params: params, message: errorMessage, - path: this.getPath(this.options.reportPathAsArray), + path: this.getPath(), schemaId: this.getSchemaId() }; @@ -21801,7 +25224,7 @@ module.exports = Report; }).call(this,require('_process')) -},{"./Errors":171,"./Utils":179,"_process":78,"lodash.get":74}],176:[function(require,module,exports){ +},{"./Errors":107,"./Utils":115,"_process":77,"lodash.get":72}],112:[function(require,module,exports){ "use strict"; var Report = require("./Report"); @@ -21956,7 +25379,7 @@ exports.getSchemaByUri = function (report, uri, root) { exports.getRemotePath = getRemotePath; -},{"./Report":175,"./SchemaCompilation":177,"./SchemaValidation":178,"./Utils":179}],177:[function(require,module,exports){ +},{"./Report":111,"./SchemaCompilation":113,"./SchemaValidation":114,"./Utils":115}],113:[function(require,module,exports){ "use strict"; var Report = require("./Report"); @@ -22257,7 +25680,7 @@ exports.compileSchema = function (report, schema) { }; -},{"./Report":175,"./SchemaCache":176,"./Utils":179}],178:[function(require,module,exports){ +},{"./Report":111,"./SchemaCache":112,"./Utils":115}],114:[function(require,module,exports){ "use strict"; var FormatValidators = require("./FormatValidators"), @@ -22866,7 +26289,7 @@ exports.validateSchema = function (report, schema) { return isValid; }; -},{"./FormatValidators":172,"./JsonValidation":173,"./Report":175,"./Utils":179}],179:[function(require,module,exports){ +},{"./FormatValidators":108,"./JsonValidation":109,"./Report":111,"./Utils":115}],115:[function(require,module,exports){ "use strict"; exports.isAbsoluteUri = function (uri) { @@ -23085,7 +26508,7 @@ exports.ucs2decode = function (string) { }; /*jshint +W016*/ -},{}],180:[function(require,module,exports){ +},{}],116:[function(require,module,exports){ (function (process){ "use strict"; @@ -23144,9 +26567,7 @@ var defaultOptions = { // check if schema follow best practices and common sence pedanticCheck: false, // ignore unknown formats (do not report them as an error) - ignoreUnknownFormats: false, - // function to be called on every schema - customValidator: null + ignoreUnknownFormats: false }; /* @@ -23442,7 +26863,7 @@ module.exports = ZSchema; }).call(this,require('_process')) -},{"./FormatValidators":172,"./JsonValidation":173,"./Polyfills":174,"./Report":175,"./SchemaCache":176,"./SchemaCompilation":177,"./SchemaValidation":178,"./Utils":179,"./schemas/hyper-schema.json":181,"./schemas/schema.json":182,"_process":78,"lodash.get":74}],181:[function(require,module,exports){ +},{"./FormatValidators":108,"./JsonValidation":109,"./Polyfills":110,"./Report":111,"./SchemaCache":112,"./SchemaCompilation":113,"./SchemaValidation":114,"./Utils":115,"./schemas/hyper-schema.json":117,"./schemas/schema.json":118,"_process":77,"lodash.get":72}],117:[function(require,module,exports){ module.exports={ "$schema": "http://json-schema.org/draft-04/hyper-schema#", "id": "http://json-schema.org/draft-04/hyper-schema#", @@ -23602,7 +27023,7 @@ module.exports={ } -},{}],182:[function(require,module,exports){ +},{}],118:[function(require,module,exports){ module.exports={ "id": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#", diff --git a/dist/swagger-parser.js.map b/dist/swagger-parser.js.map index d1e6642c..7d8cc371 100644 --- a/dist/swagger-parser.js.map +++ b/dist/swagger-parser.js.map @@ -11,15 +11,19 @@ "../node_modules/base64-js/lib/b64.js", "../node_modules/browser-resolve/empty.js", "../node_modules/buffer/index.js", + "../node_modules/buffer/node_modules/isarray/index.js", "../node_modules/builtin-status-codes/browser.js", "../node_modules/call-me-maybe/index.js", "../node_modules/core-util-is/lib/util.js", "../node_modules/debug/browser.js", "../node_modules/debug/debug.js", "../node_modules/es6-promise/dist/es6-promise.js", + "../node_modules/esprima/esprima.js", "../node_modules/events/events.js", "../node_modules/https-browserify/index.js", "../node_modules/ieee754/index.js", + "../node_modules/inherit/index.js", + "../node_modules/inherit/lib/inherit.js", "../node_modules/inherits/inherits_browser.js", "../node_modules/is-buffer/index.js", "../node_modules/isarray/index.js", @@ -58,22 +62,17 @@ "../node_modules/json-schema-ref-parser/lib/index.js", "../node_modules/json-schema-ref-parser/lib/options.js", "../node_modules/json-schema-ref-parser/lib/parse.js", - "../node_modules/json-schema-ref-parser/lib/parsers/binary.js", - "../node_modules/json-schema-ref-parser/lib/parsers/json.js", - "../node_modules/json-schema-ref-parser/lib/parsers/text.js", - "../node_modules/json-schema-ref-parser/lib/parsers/yaml.js", "../node_modules/json-schema-ref-parser/lib/pointer.js", + "../node_modules/json-schema-ref-parser/lib/read.js", "../node_modules/json-schema-ref-parser/lib/ref.js", "../node_modules/json-schema-ref-parser/lib/refs.js", "../node_modules/json-schema-ref-parser/lib/resolve.js", - "../node_modules/json-schema-ref-parser/lib/resolvers/file.js", - "../node_modules/json-schema-ref-parser/lib/resolvers/http.js", - "../node_modules/json-schema-ref-parser/lib/util/debug.js", - "../node_modules/json-schema-ref-parser/lib/util/plugins.js", - "../node_modules/json-schema-ref-parser/lib/util/url.js", - "../node_modules/json-schema-ref-parser/lib/util/yaml.js", - "../node_modules/lodash._stringtopath/index.js", + "../node_modules/json-schema-ref-parser/lib/util.js", + "../node_modules/json-schema-ref-parser/lib/yaml.js", + "../node_modules/lodash._baseget/index.js", + "../node_modules/lodash._topath/index.js", "../node_modules/lodash.get/index.js", + "../node_modules/lodash.isarray/index.js", "../node_modules/ms/index.js", "../node_modules/ono/lib/index.js", "../node_modules/process-nextick-args/index.js", @@ -100,75 +99,12 @@ "../node_modules/string_decoder/index.js", "../node_modules/swagger-methods/lib/index.js", "../node_modules/swagger-schema-official/schema.json", - "../node_modules/to-arraybuffer/index.js", "../node_modules/url/url.js", "../node_modules/url/util.js", "../node_modules/util-deprecate/browser.js", "../node_modules/util/support/isBufferBrowser.js", "../node_modules/util/util.js", - "../node_modules/validator/index.js", - "../node_modules/validator/lib/alpha.js", - "../node_modules/validator/lib/blacklist.js", - "../node_modules/validator/lib/contains.js", - "../node_modules/validator/lib/equals.js", - "../node_modules/validator/lib/escape.js", - "../node_modules/validator/lib/isAfter.js", - "../node_modules/validator/lib/isAlpha.js", - "../node_modules/validator/lib/isAlphanumeric.js", - "../node_modules/validator/lib/isAscii.js", - "../node_modules/validator/lib/isBase64.js", - "../node_modules/validator/lib/isBefore.js", - "../node_modules/validator/lib/isBoolean.js", - "../node_modules/validator/lib/isByteLength.js", - "../node_modules/validator/lib/isCreditCard.js", - "../node_modules/validator/lib/isCurrency.js", - "../node_modules/validator/lib/isDataURI.js", - "../node_modules/validator/lib/isDate.js", - "../node_modules/validator/lib/isDecimal.js", - "../node_modules/validator/lib/isDivisibleBy.js", - "../node_modules/validator/lib/isEmail.js", - "../node_modules/validator/lib/isFQDN.js", - "../node_modules/validator/lib/isFloat.js", - "../node_modules/validator/lib/isFullWidth.js", - "../node_modules/validator/lib/isHalfWidth.js", - "../node_modules/validator/lib/isHexColor.js", - "../node_modules/validator/lib/isHexadecimal.js", - "../node_modules/validator/lib/isIP.js", - "../node_modules/validator/lib/isISBN.js", - "../node_modules/validator/lib/isISIN.js", - "../node_modules/validator/lib/isISO8601.js", - "../node_modules/validator/lib/isIn.js", - "../node_modules/validator/lib/isInt.js", - "../node_modules/validator/lib/isJSON.js", - "../node_modules/validator/lib/isLength.js", - "../node_modules/validator/lib/isLowercase.js", - "../node_modules/validator/lib/isMACAddress.js", - "../node_modules/validator/lib/isMobilePhone.js", - "../node_modules/validator/lib/isMongoId.js", - "../node_modules/validator/lib/isMultibyte.js", - "../node_modules/validator/lib/isNull.js", - "../node_modules/validator/lib/isNumeric.js", - "../node_modules/validator/lib/isSurrogatePair.js", - "../node_modules/validator/lib/isURL.js", - "../node_modules/validator/lib/isUUID.js", - "../node_modules/validator/lib/isUppercase.js", - "../node_modules/validator/lib/isVariableWidth.js", - "../node_modules/validator/lib/isWhitelisted.js", - "../node_modules/validator/lib/ltrim.js", - "../node_modules/validator/lib/matches.js", - "../node_modules/validator/lib/normalizeEmail.js", - "../node_modules/validator/lib/rtrim.js", - "../node_modules/validator/lib/stripLow.js", - "../node_modules/validator/lib/toBoolean.js", - "../node_modules/validator/lib/toDate.js", - "../node_modules/validator/lib/toFloat.js", - "../node_modules/validator/lib/toInt.js", - "../node_modules/validator/lib/trim.js", - "../node_modules/validator/lib/unescape.js", - "../node_modules/validator/lib/util/assertString.js", - "../node_modules/validator/lib/util/merge.js", - "../node_modules/validator/lib/util/toString.js", - "../node_modules/validator/lib/whitelist.js", + "../node_modules/validator/validator.js", "../node_modules/xtend/immutable.js", "../node_modules/z-schema/src/Errors.js", "../node_modules/z-schema/src/FormatValidators.js", @@ -184,7 +120,7 @@ "../node_modules/z-schema/src/schemas/schema.json" ], "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5HA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5gDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC17BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5yBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACljDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACnIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACpNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC7tBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACrhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;;ACJA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC/2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACnLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACngBA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;;ACDA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC/HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACtRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7NA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5tBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACnEA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC1kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7hBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC1MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/lBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACzNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AChWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5HA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5gDA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACv8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7mLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACh1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1iDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACpIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACnQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AClIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACrhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;;ACJA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC/8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjhBA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;;ACDA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACnRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7NA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5tBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACnEA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC1kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC13BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACtMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/lBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACzNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC9VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ @@ -198,175 +134,111 @@ "var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n var Arr = (typeof Uint8Array !== 'undefined')\n ? Uint8Array\n : Array\n\n\tvar PLUS = '+'.charCodeAt(0)\n\tvar SLASH = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER = 'a'.charCodeAt(0)\n\tvar UPPER = 'A'.charCodeAt(0)\n\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\n\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS ||\n\t\t code === PLUS_URL_SAFE)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH ||\n\t\t code === SLASH_URL_SAFE)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n", "", "/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property\n * on objects.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\nfunction typedArraySupport () {\n function Bar () {}\n try {\n var arr = new Uint8Array(1)\n arr.foo = function () { return 42 }\n arr.constructor = Bar\n return arr.foo() === 42 && // typed array instances can be augmented\n arr.constructor === Bar && // constructor can be set\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n}\n\nfunction fromNumber (that, length) {\n that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < length; i++) {\n that[i] = 0\n }\n }\n return that\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n // Assumption: byteLength() return value is always < kMaxLength.\n var length = byteLength(string, encoding) | 0\n that = allocate(that, length)\n\n that.write(string, encoding)\n return that\n}\n\nfunction fromObject (that, object) {\n if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n if (isArray(object)) return fromArray(that, object)\n\n if (object == null) {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (typeof ArrayBuffer !== 'undefined') {\n if (object.buffer instanceof ArrayBuffer) {\n return fromTypedArray(that, object)\n }\n if (object instanceof ArrayBuffer) {\n return fromArrayBuffer(that, object)\n }\n }\n\n if (object.length) return fromArrayLike(that, object)\n\n return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n var length = checked(buffer.length) | 0\n that = allocate(that, length)\n buffer.copy(that, 0, 0, length)\n return that\n}\n\nfunction fromArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n array.byteLength\n that = Buffer._augment(new Uint8Array(array))\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromTypedArray(that, new Uint8Array(array))\n }\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n var array\n var length = 0\n\n if (object.type === 'Buffer' && isArray(object.data)) {\n array = object.data\n length = checked(array.length) | 0\n }\n that = allocate(that, length)\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n} else {\n // pre-set for values that may exist in the future\n Buffer.prototype.length = undefined\n Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = Buffer._augment(new Uint8Array(length))\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that.length = length\n that._isBuffer = true\n }\n\n var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n if (fromPool) that.parent = rootParent\n\n return that\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n var i = 0\n var len = Math.min(x, y)\n while (i < len) {\n if (a[i] !== b[i]) break\n\n ++i\n }\n\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; i++) {\n length += list[i].length\n }\n }\n\n var buf = new Buffer(length)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nfunction byteLength (string, encoding) {\n if (typeof string !== 'string') string = '' + string\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'binary':\n // Deprecated\n case 'raw':\n case 'raws':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n start = start | 0\n end = end === undefined || end === Infinity ? this.length : end | 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` is deprecated\nBuffer.prototype.get = function get (offset) {\n console.log('.get() is deprecated. Access using array indexes instead.')\n return this.readUInt8(offset)\n}\n\n// `set` is deprecated\nBuffer.prototype.set = function set (v, offset) {\n console.log('.set() is deprecated. Access using array indexes instead.')\n return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n var swap = encoding\n encoding = offset\n offset = length | 0\n length = swap\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'binary':\n return binaryWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = Buffer._augment(this.subarray(start, end))\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; i--) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; i++) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n target._set(this.subarray(start, start + len), targetStart)\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n if (typeof Uint8Array !== 'undefined') {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n return (new Buffer(this)).buffer\n } else {\n var buf = new Uint8Array(this.length)\n for (var i = 0, len = buf.length; i < len; i += 1) {\n buf[i] = this[i]\n }\n return buf.buffer\n }\n } else {\n throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n arr.constructor = Buffer\n arr._isBuffer = true\n\n // save reference to original Uint8Array set method before overwriting\n arr._set = arr.set\n\n // deprecated\n arr.get = BP.get\n arr.set = BP.set\n\n arr.write = BP.write\n arr.toString = BP.toString\n arr.toLocaleString = BP.toString\n arr.toJSON = BP.toJSON\n arr.equals = BP.equals\n arr.compare = BP.compare\n arr.indexOf = BP.indexOf\n arr.copy = BP.copy\n arr.slice = BP.slice\n arr.readUIntLE = BP.readUIntLE\n arr.readUIntBE = BP.readUIntBE\n arr.readUInt8 = BP.readUInt8\n arr.readUInt16LE = BP.readUInt16LE\n arr.readUInt16BE = BP.readUInt16BE\n arr.readUInt32LE = BP.readUInt32LE\n arr.readUInt32BE = BP.readUInt32BE\n arr.readIntLE = BP.readIntLE\n arr.readIntBE = BP.readIntBE\n arr.readInt8 = BP.readInt8\n arr.readInt16LE = BP.readInt16LE\n arr.readInt16BE = BP.readInt16BE\n arr.readInt32LE = BP.readInt32LE\n arr.readInt32BE = BP.readInt32BE\n arr.readFloatLE = BP.readFloatLE\n arr.readFloatBE = BP.readFloatBE\n arr.readDoubleLE = BP.readDoubleLE\n arr.readDoubleBE = BP.readDoubleBE\n arr.writeUInt8 = BP.writeUInt8\n arr.writeUIntLE = BP.writeUIntLE\n arr.writeUIntBE = BP.writeUIntBE\n arr.writeUInt16LE = BP.writeUInt16LE\n arr.writeUInt16BE = BP.writeUInt16BE\n arr.writeUInt32LE = BP.writeUInt32LE\n arr.writeUInt32BE = BP.writeUInt32BE\n arr.writeIntLE = BP.writeIntLE\n arr.writeIntBE = BP.writeIntBE\n arr.writeInt8 = BP.writeInt8\n arr.writeInt16LE = BP.writeInt16LE\n arr.writeInt16BE = BP.writeInt16BE\n arr.writeInt32LE = BP.writeInt32LE\n arr.writeInt32BE = BP.writeInt32BE\n arr.writeFloatLE = BP.writeFloatLE\n arr.writeFloatBE = BP.writeFloatBE\n arr.writeDoubleLE = BP.writeDoubleLE\n arr.writeDoubleBE = BP.writeDoubleBE\n arr.fill = BP.fill\n arr.inspect = BP.inspect\n arr.toArrayBuffer = BP.toArrayBuffer\n\n return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n", - "module.exports = {\n \"100\": \"Continue\",\n \"101\": \"Switching Protocols\",\n \"102\": \"Processing\",\n \"200\": \"OK\",\n \"201\": \"Created\",\n \"202\": \"Accepted\",\n \"203\": \"Non-Authoritative Information\",\n \"204\": \"No Content\",\n \"205\": \"Reset Content\",\n \"206\": \"Partial Content\",\n \"207\": \"Multi-Status\",\n \"208\": \"Already Reported\",\n \"226\": \"IM Used\",\n \"300\": \"Multiple Choices\",\n \"301\": \"Moved Permanently\",\n \"302\": \"Found\",\n \"303\": \"See Other\",\n \"304\": \"Not Modified\",\n \"305\": \"Use Proxy\",\n \"307\": \"Temporary Redirect\",\n \"308\": \"Permanent Redirect\",\n \"400\": \"Bad Request\",\n \"401\": \"Unauthorized\",\n \"402\": \"Payment Required\",\n \"403\": \"Forbidden\",\n \"404\": \"Not Found\",\n \"405\": \"Method Not Allowed\",\n \"406\": \"Not Acceptable\",\n \"407\": \"Proxy Authentication Required\",\n \"408\": \"Request Timeout\",\n \"409\": \"Conflict\",\n \"410\": \"Gone\",\n \"411\": \"Length Required\",\n \"412\": \"Precondition Failed\",\n \"413\": \"Payload Too Large\",\n \"414\": \"URI Too Long\",\n \"415\": \"Unsupported Media Type\",\n \"416\": \"Range Not Satisfiable\",\n \"417\": \"Expectation Failed\",\n \"418\": \"I'm a teapot\",\n \"421\": \"Misdirected Request\",\n \"422\": \"Unprocessable Entity\",\n \"423\": \"Locked\",\n \"424\": \"Failed Dependency\",\n \"425\": \"Unordered Collection\",\n \"426\": \"Upgrade Required\",\n \"428\": \"Precondition Required\",\n \"429\": \"Too Many Requests\",\n \"431\": \"Request Header Fields Too Large\",\n \"500\": \"Internal Server Error\",\n \"501\": \"Not Implemented\",\n \"502\": \"Bad Gateway\",\n \"503\": \"Service Unavailable\",\n \"504\": \"Gateway Timeout\",\n \"505\": \"HTTP Version Not Supported\",\n \"506\": \"Variant Also Negotiates\",\n \"507\": \"Insufficient Storage\",\n \"508\": \"Loop Detected\",\n \"509\": \"Bandwidth Limit Exceeded\",\n \"510\": \"Not Extended\",\n \"511\": \"Network Authentication Required\"\n}\n", + "var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n", + "module.exports = {\n \"100\": \"Continue\",\n \"101\": \"Switching Protocols\",\n \"102\": \"Processing\",\n \"200\": \"OK\",\n \"201\": \"Created\",\n \"202\": \"Accepted\",\n \"203\": \"Non-Authoritative Information\",\n \"204\": \"No Content\",\n \"205\": \"Reset Content\",\n \"206\": \"Partial Content\",\n \"207\": \"Multi-Status\",\n \"300\": \"Multiple Choices\",\n \"301\": \"Moved Permanently\",\n \"302\": \"Moved Temporarily\",\n \"303\": \"See Other\",\n \"304\": \"Not Modified\",\n \"305\": \"Use Proxy\",\n \"307\": \"Temporary Redirect\",\n \"308\": \"Permanent Redirect\",\n \"400\": \"Bad Request\",\n \"401\": \"Unauthorized\",\n \"402\": \"Payment Required\",\n \"403\": \"Forbidden\",\n \"404\": \"Not Found\",\n \"405\": \"Method Not Allowed\",\n \"406\": \"Not Acceptable\",\n \"407\": \"Proxy Authentication Required\",\n \"408\": \"Request Time-out\",\n \"409\": \"Conflict\",\n \"410\": \"Gone\",\n \"411\": \"Length Required\",\n \"412\": \"Precondition Failed\",\n \"413\": \"Request Entity Too Large\",\n \"414\": \"Request-URI Too Large\",\n \"415\": \"Unsupported Media Type\",\n \"416\": \"Requested Range Not Satisfiable\",\n \"417\": \"Expectation Failed\",\n \"418\": \"I'm a teapot\",\n \"422\": \"Unprocessable Entity\",\n \"423\": \"Locked\",\n \"424\": \"Failed Dependency\",\n \"425\": \"Unordered Collection\",\n \"426\": \"Upgrade Required\",\n \"428\": \"Precondition Required\",\n \"429\": \"Too Many Requests\",\n \"431\": \"Request Header Fields Too Large\",\n \"500\": \"Internal Server Error\",\n \"501\": \"Not Implemented\",\n \"502\": \"Bad Gateway\",\n \"503\": \"Service Unavailable\",\n \"504\": \"Gateway Time-out\",\n \"505\": \"HTTP Version Not Supported\",\n \"506\": \"Variant Also Negotiates\",\n \"507\": \"Insufficient Storage\",\n \"509\": \"Bandwidth Limit Exceeded\",\n \"510\": \"Not Extended\",\n \"511\": \"Network Authentication Required\"\n}\n", "\"use strict\"\n\nvar next = (global.process && process.nextTick) || global.setImmediate || function (f) {\n setTimeout(f, 0)\n}\n\nmodule.exports = function maybe (cb, promise) {\n if (cb) {\n promise\n .then(function (result) {\n next(function () { cb(null, result) })\n }, function (err) {\n next(function () { cb(err) })\n })\n return undefined\n }\n else {\n return promise\n }\n}\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n", "\n/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n 'lightseagreen',\n 'forestgreen',\n 'goldenrod',\n 'dodgerblue',\n 'darkorchid',\n 'crimson'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // is webkit? http://stackoverflow.com/a/16459606/376773\n return ('WebkitAppearance' in document.documentElement.style) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (window.console && (console.firebug || (console.exception && console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31);\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n return JSON.stringify(v);\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs() {\n var args = arguments;\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return args;\n\n var c = 'color: ' + this.color;\n args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n return args;\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage(){\n try {\n return window.localStorage;\n } catch (e) {}\n}\n", "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = debug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lowercased letter, i.e. \"n\".\n */\n\nexports.formatters = {};\n\n/**\n * Previously assigned color.\n */\n\nvar prevColor = 0;\n\n/**\n * Previous log timestamp.\n */\n\nvar prevTime;\n\n/**\n * Select a color.\n *\n * @return {Number}\n * @api private\n */\n\nfunction selectColor() {\n return exports.colors[prevColor++ % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction debug(namespace) {\n\n // define the `disabled` version\n function disabled() {\n }\n disabled.enabled = false;\n\n // define the `enabled` version\n function enabled() {\n\n var self = enabled;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // add the `color` if not set\n if (null == self.useColors) self.useColors = exports.useColors();\n if (null == self.color && self.useColors) self.color = selectColor();\n\n var args = Array.prototype.slice.call(arguments);\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %o\n args = ['%o'].concat(args);\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n if ('function' === typeof exports.formatArgs) {\n args = exports.formatArgs.apply(self, args);\n }\n var logFn = enabled.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n enabled.enabled = true;\n\n var fn = exports.enabled(namespace) ? enabled : disabled;\n\n fn.namespace = namespace;\n\n return fn;\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n var split = (namespaces || '').split(/[\\s,]+/);\n var len = split.length;\n\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n", - "/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE\n * @version 3.1.2\n */\n\n(function() {\n \"use strict\";\n function lib$es6$promise$utils$$objectOrFunction(x) {\n return typeof x === 'function' || (typeof x === 'object' && x !== null);\n }\n\n function lib$es6$promise$utils$$isFunction(x) {\n return typeof x === 'function';\n }\n\n function lib$es6$promise$utils$$isMaybeThenable(x) {\n return typeof x === 'object' && x !== null;\n }\n\n var lib$es6$promise$utils$$_isArray;\n if (!Array.isArray) {\n lib$es6$promise$utils$$_isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n } else {\n lib$es6$promise$utils$$_isArray = Array.isArray;\n }\n\n var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;\n var lib$es6$promise$asap$$len = 0;\n var lib$es6$promise$asap$$vertxNext;\n var lib$es6$promise$asap$$customSchedulerFn;\n\n var lib$es6$promise$asap$$asap = function asap(callback, arg) {\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;\n lib$es6$promise$asap$$len += 2;\n if (lib$es6$promise$asap$$len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (lib$es6$promise$asap$$customSchedulerFn) {\n lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);\n } else {\n lib$es6$promise$asap$$scheduleFlush();\n }\n }\n }\n\n function lib$es6$promise$asap$$setScheduler(scheduleFn) {\n lib$es6$promise$asap$$customSchedulerFn = scheduleFn;\n }\n\n function lib$es6$promise$asap$$setAsap(asapFn) {\n lib$es6$promise$asap$$asap = asapFn;\n }\n\n var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;\n var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};\n var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;\n var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n // test for web worker but not in IE10\n var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&\n typeof importScripts !== 'undefined' &&\n typeof MessageChannel !== 'undefined';\n\n // node\n function lib$es6$promise$asap$$useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function() {\n process.nextTick(lib$es6$promise$asap$$flush);\n };\n }\n\n // vertx\n function lib$es6$promise$asap$$useVertxTimer() {\n return function() {\n lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);\n };\n }\n\n function lib$es6$promise$asap$$useMutationObserver() {\n var iterations = 0;\n var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function() {\n node.data = (iterations = ++iterations % 2);\n };\n }\n\n // web worker\n function lib$es6$promise$asap$$useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = lib$es6$promise$asap$$flush;\n return function () {\n channel.port2.postMessage(0);\n };\n }\n\n function lib$es6$promise$asap$$useSetTimeout() {\n return function() {\n setTimeout(lib$es6$promise$asap$$flush, 1);\n };\n }\n\n var lib$es6$promise$asap$$queue = new Array(1000);\n function lib$es6$promise$asap$$flush() {\n for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {\n var callback = lib$es6$promise$asap$$queue[i];\n var arg = lib$es6$promise$asap$$queue[i+1];\n\n callback(arg);\n\n lib$es6$promise$asap$$queue[i] = undefined;\n lib$es6$promise$asap$$queue[i+1] = undefined;\n }\n\n lib$es6$promise$asap$$len = 0;\n }\n\n function lib$es6$promise$asap$$attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return lib$es6$promise$asap$$useVertxTimer();\n } catch(e) {\n return lib$es6$promise$asap$$useSetTimeout();\n }\n }\n\n var lib$es6$promise$asap$$scheduleFlush;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (lib$es6$promise$asap$$isNode) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();\n } else if (lib$es6$promise$asap$$BrowserMutationObserver) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();\n } else if (lib$es6$promise$asap$$isWorker) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();\n } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();\n } else {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();\n }\n function lib$es6$promise$then$$then(onFulfillment, onRejection) {\n var parent = this;\n var state = parent._state;\n\n if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {\n return this;\n }\n\n var child = new this.constructor(lib$es6$promise$$internal$$noop);\n var result = parent._result;\n\n if (state) {\n var callback = arguments[state - 1];\n lib$es6$promise$asap$$asap(function(){\n lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);\n });\n } else {\n lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n }\n var lib$es6$promise$then$$default = lib$es6$promise$then$$then;\n function lib$es6$promise$promise$resolve$$resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$resolve(promise, object);\n return promise;\n }\n var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;\n\n function lib$es6$promise$$internal$$noop() {}\n\n var lib$es6$promise$$internal$$PENDING = void 0;\n var lib$es6$promise$$internal$$FULFILLED = 1;\n var lib$es6$promise$$internal$$REJECTED = 2;\n\n var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n\n function lib$es6$promise$$internal$$cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n\n function lib$es6$promise$$internal$$getThen(promise) {\n try {\n return promise.then;\n } catch(error) {\n lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;\n return lib$es6$promise$$internal$$GET_THEN_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch(e) {\n return e;\n }\n }\n\n function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {\n lib$es6$promise$asap$$asap(function(promise) {\n var sealed = false;\n var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {\n if (sealed) { return; }\n sealed = true;\n if (thenable !== value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }, function(reason) {\n if (sealed) { return; }\n sealed = true;\n\n lib$es6$promise$$internal$$reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n lib$es6$promise$$internal$$reject(promise, error);\n }\n }, promise);\n }\n\n function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {\n if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, thenable._result);\n } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, thenable._result);\n } else {\n lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n }\n }\n\n function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor &&\n then === lib$es6$promise$then$$default &&\n constructor.resolve === lib$es6$promise$promise$resolve$$default) {\n lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);\n } else if (then === undefined) {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n } else if (lib$es6$promise$utils$$isFunction(then)) {\n lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n }\n }\n }\n\n function lib$es6$promise$$internal$$resolve(promise, value) {\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());\n } else if (lib$es6$promise$utils$$objectOrFunction(value)) {\n lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n lib$es6$promise$$internal$$publish(promise);\n }\n\n function lib$es6$promise$$internal$$fulfill(promise, value) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n\n promise._result = value;\n promise._state = lib$es6$promise$$internal$$FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);\n }\n }\n\n function lib$es6$promise$$internal$$reject(promise, reason) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n promise._state = lib$es6$promise$$internal$$REJECTED;\n promise._result = reason;\n\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);\n }\n\n function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n parent._onerror = null;\n\n subscribers[length] = child;\n subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;\n subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);\n }\n }\n\n function lib$es6$promise$$internal$$publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) { return; }\n\n var child, callback, detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n }\n\n function lib$es6$promise$$internal$$ErrorObject() {\n this.error = null;\n }\n\n var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch(e) {\n lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;\n return lib$es6$promise$$internal$$TRY_CATCH_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {\n var hasCallback = lib$es6$promise$utils$$isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n value = lib$es6$promise$$internal$$tryCatch(callback, detail);\n\n if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());\n return;\n }\n\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== lib$es6$promise$$internal$$PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else if (failed) {\n lib$es6$promise$$internal$$reject(promise, error);\n } else if (settled === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, value);\n } else if (settled === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value){\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function rejectPromise(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n } catch(e) {\n lib$es6$promise$$internal$$reject(promise, e);\n }\n }\n\n function lib$es6$promise$promise$all$$all(entries) {\n return new lib$es6$promise$enumerator$$default(this, entries).promise;\n }\n var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;\n function lib$es6$promise$promise$race$$race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (!lib$es6$promise$utils$$isArray(entries)) {\n lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));\n return promise;\n }\n\n var length = entries.length;\n\n function onFulfillment(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }\n\n function onRejection(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n }\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);\n }\n\n return promise;\n }\n var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;\n function lib$es6$promise$promise$reject$$reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$reject(promise, reason);\n return promise;\n }\n var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;\n\n var lib$es6$promise$promise$$counter = 0;\n\n function lib$es6$promise$promise$$needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n function lib$es6$promise$promise$$needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n */\n function lib$es6$promise$promise$$Promise(resolver) {\n this._id = lib$es6$promise$promise$$counter++;\n this._state = undefined;\n this._result = undefined;\n this._subscribers = [];\n\n if (lib$es6$promise$$internal$$noop !== resolver) {\n typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();\n this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();\n }\n }\n\n lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;\n lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;\n lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;\n lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;\n lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;\n lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;\n lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;\n\n lib$es6$promise$promise$$Promise.prototype = {\n constructor: lib$es6$promise$promise$$Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: lib$es6$promise$then$$default,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n };\n var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;\n function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (Array.isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n }\n }\n } else {\n lib$es6$promise$$internal$$reject(this.promise, this._validationError());\n }\n }\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {\n return new Error('Array Methods must be provided an Array');\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {\n var length = this.length;\n var input = this._input;\n\n for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n if (resolve === lib$es6$promise$promise$resolve$$default) {\n var then = lib$es6$promise$$internal$$getThen(entry);\n\n if (then === lib$es6$promise$then$$default &&\n entry._state !== lib$es6$promise$$internal$$PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === lib$es6$promise$promise$$default) {\n var promise = new c(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {\n var promise = this.promise;\n\n if (promise._state === lib$es6$promise$$internal$$PENDING) {\n this._remaining--;\n\n if (state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(promise, this._result);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {\n var enumerator = this;\n\n lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {\n enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);\n }, function(reason) {\n enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);\n });\n };\n function lib$es6$promise$polyfill$$polyfill() {\n var local;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {\n return;\n }\n\n local.Promise = lib$es6$promise$promise$$default;\n }\n var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;\n\n var lib$es6$promise$umd$$ES6Promise = {\n 'Promise': lib$es6$promise$promise$$default,\n 'polyfill': lib$es6$promise$polyfill$$default\n };\n\n /* global define:true module:true window: true */\n if (typeof define === 'function' && define['amd']) {\n define(function() { return lib$es6$promise$umd$$ES6Promise; });\n } else if (typeof module !== 'undefined' && module['exports']) {\n module['exports'] = lib$es6$promise$umd$$ES6Promise;\n } else if (typeof this !== 'undefined') {\n this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;\n }\n\n lib$es6$promise$polyfill$$default();\n}).call(this);\n\n", + "/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE\n * @version 3.0.2\n */\n\n(function() {\n \"use strict\";\n function lib$es6$promise$utils$$objectOrFunction(x) {\n return typeof x === 'function' || (typeof x === 'object' && x !== null);\n }\n\n function lib$es6$promise$utils$$isFunction(x) {\n return typeof x === 'function';\n }\n\n function lib$es6$promise$utils$$isMaybeThenable(x) {\n return typeof x === 'object' && x !== null;\n }\n\n var lib$es6$promise$utils$$_isArray;\n if (!Array.isArray) {\n lib$es6$promise$utils$$_isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n } else {\n lib$es6$promise$utils$$_isArray = Array.isArray;\n }\n\n var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;\n var lib$es6$promise$asap$$len = 0;\n var lib$es6$promise$asap$$toString = {}.toString;\n var lib$es6$promise$asap$$vertxNext;\n var lib$es6$promise$asap$$customSchedulerFn;\n\n var lib$es6$promise$asap$$asap = function asap(callback, arg) {\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;\n lib$es6$promise$asap$$len += 2;\n if (lib$es6$promise$asap$$len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (lib$es6$promise$asap$$customSchedulerFn) {\n lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);\n } else {\n lib$es6$promise$asap$$scheduleFlush();\n }\n }\n }\n\n function lib$es6$promise$asap$$setScheduler(scheduleFn) {\n lib$es6$promise$asap$$customSchedulerFn = scheduleFn;\n }\n\n function lib$es6$promise$asap$$setAsap(asapFn) {\n lib$es6$promise$asap$$asap = asapFn;\n }\n\n var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;\n var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};\n var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;\n var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n // test for web worker but not in IE10\n var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&\n typeof importScripts !== 'undefined' &&\n typeof MessageChannel !== 'undefined';\n\n // node\n function lib$es6$promise$asap$$useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function() {\n process.nextTick(lib$es6$promise$asap$$flush);\n };\n }\n\n // vertx\n function lib$es6$promise$asap$$useVertxTimer() {\n return function() {\n lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);\n };\n }\n\n function lib$es6$promise$asap$$useMutationObserver() {\n var iterations = 0;\n var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function() {\n node.data = (iterations = ++iterations % 2);\n };\n }\n\n // web worker\n function lib$es6$promise$asap$$useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = lib$es6$promise$asap$$flush;\n return function () {\n channel.port2.postMessage(0);\n };\n }\n\n function lib$es6$promise$asap$$useSetTimeout() {\n return function() {\n setTimeout(lib$es6$promise$asap$$flush, 1);\n };\n }\n\n var lib$es6$promise$asap$$queue = new Array(1000);\n function lib$es6$promise$asap$$flush() {\n for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {\n var callback = lib$es6$promise$asap$$queue[i];\n var arg = lib$es6$promise$asap$$queue[i+1];\n\n callback(arg);\n\n lib$es6$promise$asap$$queue[i] = undefined;\n lib$es6$promise$asap$$queue[i+1] = undefined;\n }\n\n lib$es6$promise$asap$$len = 0;\n }\n\n function lib$es6$promise$asap$$attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return lib$es6$promise$asap$$useVertxTimer();\n } catch(e) {\n return lib$es6$promise$asap$$useSetTimeout();\n }\n }\n\n var lib$es6$promise$asap$$scheduleFlush;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (lib$es6$promise$asap$$isNode) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();\n } else if (lib$es6$promise$asap$$BrowserMutationObserver) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();\n } else if (lib$es6$promise$asap$$isWorker) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();\n } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();\n } else {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();\n }\n\n function lib$es6$promise$$internal$$noop() {}\n\n var lib$es6$promise$$internal$$PENDING = void 0;\n var lib$es6$promise$$internal$$FULFILLED = 1;\n var lib$es6$promise$$internal$$REJECTED = 2;\n\n var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n\n function lib$es6$promise$$internal$$cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n\n function lib$es6$promise$$internal$$getThen(promise) {\n try {\n return promise.then;\n } catch(error) {\n lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;\n return lib$es6$promise$$internal$$GET_THEN_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch(e) {\n return e;\n }\n }\n\n function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {\n lib$es6$promise$asap$$asap(function(promise) {\n var sealed = false;\n var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {\n if (sealed) { return; }\n sealed = true;\n if (thenable !== value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }, function(reason) {\n if (sealed) { return; }\n sealed = true;\n\n lib$es6$promise$$internal$$reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n lib$es6$promise$$internal$$reject(promise, error);\n }\n }, promise);\n }\n\n function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {\n if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, thenable._result);\n } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, thenable._result);\n } else {\n lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n }\n }\n\n function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {\n if (maybeThenable.constructor === promise.constructor) {\n lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);\n } else {\n var then = lib$es6$promise$$internal$$getThen(maybeThenable);\n\n if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);\n } else if (then === undefined) {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n } else if (lib$es6$promise$utils$$isFunction(then)) {\n lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n }\n }\n }\n\n function lib$es6$promise$$internal$$resolve(promise, value) {\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());\n } else if (lib$es6$promise$utils$$objectOrFunction(value)) {\n lib$es6$promise$$internal$$handleMaybeThenable(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n lib$es6$promise$$internal$$publish(promise);\n }\n\n function lib$es6$promise$$internal$$fulfill(promise, value) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n\n promise._result = value;\n promise._state = lib$es6$promise$$internal$$FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);\n }\n }\n\n function lib$es6$promise$$internal$$reject(promise, reason) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n promise._state = lib$es6$promise$$internal$$REJECTED;\n promise._result = reason;\n\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);\n }\n\n function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n parent._onerror = null;\n\n subscribers[length] = child;\n subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;\n subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);\n }\n }\n\n function lib$es6$promise$$internal$$publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) { return; }\n\n var child, callback, detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n }\n\n function lib$es6$promise$$internal$$ErrorObject() {\n this.error = null;\n }\n\n var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch(e) {\n lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;\n return lib$es6$promise$$internal$$TRY_CATCH_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {\n var hasCallback = lib$es6$promise$utils$$isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n value = lib$es6$promise$$internal$$tryCatch(callback, detail);\n\n if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());\n return;\n }\n\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== lib$es6$promise$$internal$$PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else if (failed) {\n lib$es6$promise$$internal$$reject(promise, error);\n } else if (settled === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, value);\n } else if (settled === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value){\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function rejectPromise(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n } catch(e) {\n lib$es6$promise$$internal$$reject(promise, e);\n }\n }\n\n function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {\n var enumerator = this;\n\n enumerator._instanceConstructor = Constructor;\n enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (enumerator._validateInput(input)) {\n enumerator._input = input;\n enumerator.length = input.length;\n enumerator._remaining = input.length;\n\n enumerator._init();\n\n if (enumerator.length === 0) {\n lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);\n } else {\n enumerator.length = enumerator.length || 0;\n enumerator._enumerate();\n if (enumerator._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);\n }\n }\n } else {\n lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());\n }\n }\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {\n return lib$es6$promise$utils$$isArray(input);\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {\n return new Error('Array Methods must be provided an Array');\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {\n this._result = new Array(this.length);\n };\n\n var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;\n\n lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {\n var enumerator = this;\n\n var length = enumerator.length;\n var promise = enumerator.promise;\n var input = enumerator._input;\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n enumerator._eachEntry(input[i], i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {\n var enumerator = this;\n var c = enumerator._instanceConstructor;\n\n if (lib$es6$promise$utils$$isMaybeThenable(entry)) {\n if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {\n entry._onerror = null;\n enumerator._settledAt(entry._state, i, entry._result);\n } else {\n enumerator._willSettleAt(c.resolve(entry), i);\n }\n } else {\n enumerator._remaining--;\n enumerator._result[i] = entry;\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {\n var enumerator = this;\n var promise = enumerator.promise;\n\n if (promise._state === lib$es6$promise$$internal$$PENDING) {\n enumerator._remaining--;\n\n if (state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n } else {\n enumerator._result[i] = value;\n }\n }\n\n if (enumerator._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(promise, enumerator._result);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {\n var enumerator = this;\n\n lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {\n enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);\n }, function(reason) {\n enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);\n });\n };\n function lib$es6$promise$promise$all$$all(entries) {\n return new lib$es6$promise$enumerator$$default(this, entries).promise;\n }\n var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;\n function lib$es6$promise$promise$race$$race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (!lib$es6$promise$utils$$isArray(entries)) {\n lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));\n return promise;\n }\n\n var length = entries.length;\n\n function onFulfillment(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }\n\n function onRejection(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n }\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);\n }\n\n return promise;\n }\n var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;\n function lib$es6$promise$promise$resolve$$resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$resolve(promise, object);\n return promise;\n }\n var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;\n function lib$es6$promise$promise$reject$$reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$reject(promise, reason);\n return promise;\n }\n var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;\n\n var lib$es6$promise$promise$$counter = 0;\n\n function lib$es6$promise$promise$$needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n function lib$es6$promise$promise$$needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n */\n function lib$es6$promise$promise$$Promise(resolver) {\n this._id = lib$es6$promise$promise$$counter++;\n this._state = undefined;\n this._result = undefined;\n this._subscribers = [];\n\n if (lib$es6$promise$$internal$$noop !== resolver) {\n if (!lib$es6$promise$utils$$isFunction(resolver)) {\n lib$es6$promise$promise$$needsResolver();\n }\n\n if (!(this instanceof lib$es6$promise$promise$$Promise)) {\n lib$es6$promise$promise$$needsNew();\n }\n\n lib$es6$promise$$internal$$initializePromise(this, resolver);\n }\n }\n\n lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;\n lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;\n lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;\n lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;\n lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;\n lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;\n lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;\n\n lib$es6$promise$promise$$Promise.prototype = {\n constructor: lib$es6$promise$promise$$Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: function(onFulfillment, onRejection) {\n var parent = this;\n var state = parent._state;\n\n if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {\n return this;\n }\n\n var child = new this.constructor(lib$es6$promise$$internal$$noop);\n var result = parent._result;\n\n if (state) {\n var callback = arguments[state - 1];\n lib$es6$promise$asap$$asap(function(){\n lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);\n });\n } else {\n lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n },\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n };\n function lib$es6$promise$polyfill$$polyfill() {\n var local;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {\n return;\n }\n\n local.Promise = lib$es6$promise$promise$$default;\n }\n var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;\n\n var lib$es6$promise$umd$$ES6Promise = {\n 'Promise': lib$es6$promise$promise$$default,\n 'polyfill': lib$es6$promise$polyfill$$default\n };\n\n /* global define:true module:true window: true */\n if (typeof define === 'function' && define['amd']) {\n define(function() { return lib$es6$promise$umd$$ES6Promise; });\n } else if (typeof module !== 'undefined' && module['exports']) {\n module['exports'] = lib$es6$promise$umd$$ES6Promise;\n } else if (typeof this !== 'undefined') {\n this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;\n }\n\n lib$es6$promise$polyfill$$default();\n}).call(this);\n\n", + "/*\n Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n(function (root, factory) {\n 'use strict';\n\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,\n // Rhino, and plain browser loading.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define(['exports'], factory);\n } else if (typeof exports !== 'undefined') {\n factory(exports);\n } else {\n factory((root.esprima = {}));\n }\n}(this, function (exports) {\n 'use strict';\n\n var Token,\n TokenName,\n FnExprTokens,\n Syntax,\n PlaceHolders,\n Messages,\n Regex,\n source,\n strict,\n index,\n lineNumber,\n lineStart,\n hasLineTerminator,\n lastIndex,\n lastLineNumber,\n lastLineStart,\n startIndex,\n startLineNumber,\n startLineStart,\n scanning,\n length,\n lookahead,\n state,\n extra,\n isBindingElement,\n isAssignmentTarget,\n firstCoverInitializedNameError;\n\n Token = {\n BooleanLiteral: 1,\n EOF: 2,\n Identifier: 3,\n Keyword: 4,\n NullLiteral: 5,\n NumericLiteral: 6,\n Punctuator: 7,\n StringLiteral: 8,\n RegularExpression: 9,\n Template: 10\n };\n\n TokenName = {};\n TokenName[Token.BooleanLiteral] = 'Boolean';\n TokenName[Token.EOF] = '';\n TokenName[Token.Identifier] = 'Identifier';\n TokenName[Token.Keyword] = 'Keyword';\n TokenName[Token.NullLiteral] = 'Null';\n TokenName[Token.NumericLiteral] = 'Numeric';\n TokenName[Token.Punctuator] = 'Punctuator';\n TokenName[Token.StringLiteral] = 'String';\n TokenName[Token.RegularExpression] = 'RegularExpression';\n TokenName[Token.Template] = 'Template';\n\n // A function following one of those tokens is an expression.\n FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',\n 'return', 'case', 'delete', 'throw', 'void',\n // assignment operators\n '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',\n '&=', '|=', '^=', ',',\n // binary/unary operators\n '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',\n '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',\n '<=', '<', '>', '!=', '!=='];\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n AssignmentPattern: 'AssignmentPattern',\n ArrayExpression: 'ArrayExpression',\n ArrayPattern: 'ArrayPattern',\n ArrowFunctionExpression: 'ArrowFunctionExpression',\n BlockStatement: 'BlockStatement',\n BinaryExpression: 'BinaryExpression',\n BreakStatement: 'BreakStatement',\n CallExpression: 'CallExpression',\n CatchClause: 'CatchClause',\n ClassBody: 'ClassBody',\n ClassDeclaration: 'ClassDeclaration',\n ClassExpression: 'ClassExpression',\n ConditionalExpression: 'ConditionalExpression',\n ContinueStatement: 'ContinueStatement',\n DoWhileStatement: 'DoWhileStatement',\n DebuggerStatement: 'DebuggerStatement',\n EmptyStatement: 'EmptyStatement',\n ExportAllDeclaration: 'ExportAllDeclaration',\n ExportDefaultDeclaration: 'ExportDefaultDeclaration',\n ExportNamedDeclaration: 'ExportNamedDeclaration',\n ExportSpecifier: 'ExportSpecifier',\n ExpressionStatement: 'ExpressionStatement',\n ForStatement: 'ForStatement',\n ForOfStatement: 'ForOfStatement',\n ForInStatement: 'ForInStatement',\n FunctionDeclaration: 'FunctionDeclaration',\n FunctionExpression: 'FunctionExpression',\n Identifier: 'Identifier',\n IfStatement: 'IfStatement',\n ImportDeclaration: 'ImportDeclaration',\n ImportDefaultSpecifier: 'ImportDefaultSpecifier',\n ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',\n ImportSpecifier: 'ImportSpecifier',\n Literal: 'Literal',\n LabeledStatement: 'LabeledStatement',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n MetaProperty: 'MetaProperty',\n MethodDefinition: 'MethodDefinition',\n NewExpression: 'NewExpression',\n ObjectExpression: 'ObjectExpression',\n ObjectPattern: 'ObjectPattern',\n Program: 'Program',\n Property: 'Property',\n RestElement: 'RestElement',\n ReturnStatement: 'ReturnStatement',\n SequenceExpression: 'SequenceExpression',\n SpreadElement: 'SpreadElement',\n Super: 'Super',\n SwitchCase: 'SwitchCase',\n SwitchStatement: 'SwitchStatement',\n TaggedTemplateExpression: 'TaggedTemplateExpression',\n TemplateElement: 'TemplateElement',\n TemplateLiteral: 'TemplateLiteral',\n ThisExpression: 'ThisExpression',\n ThrowStatement: 'ThrowStatement',\n TryStatement: 'TryStatement',\n UnaryExpression: 'UnaryExpression',\n UpdateExpression: 'UpdateExpression',\n VariableDeclaration: 'VariableDeclaration',\n VariableDeclarator: 'VariableDeclarator',\n WhileStatement: 'WhileStatement',\n WithStatement: 'WithStatement',\n YieldExpression: 'YieldExpression'\n };\n\n PlaceHolders = {\n ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder'\n };\n\n // Error messages should be identical to V8.\n Messages = {\n UnexpectedToken: 'Unexpected token %0',\n UnexpectedNumber: 'Unexpected number',\n UnexpectedString: 'Unexpected string',\n UnexpectedIdentifier: 'Unexpected identifier',\n UnexpectedReserved: 'Unexpected reserved word',\n UnexpectedTemplate: 'Unexpected quasi %0',\n UnexpectedEOS: 'Unexpected end of input',\n NewlineAfterThrow: 'Illegal newline after throw',\n InvalidRegExp: 'Invalid regular expression',\n UnterminatedRegExp: 'Invalid regular expression: missing /',\n InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',\n MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n NoCatchOrFinally: 'Missing catch or finally after try',\n UnknownLabel: 'Undefined label \\'%0\\'',\n Redeclaration: '%0 \\'%1\\' has already been declared',\n IllegalContinue: 'Illegal continue statement',\n IllegalBreak: 'Illegal break statement',\n IllegalReturn: 'Illegal return statement',\n StrictModeWith: 'Strict mode code may not include a with statement',\n StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n StrictReservedWord: 'Use of future reserved word in strict mode',\n TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',\n ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',\n DefaultRestParameter: 'Unexpected token =',\n ObjectPatternAsRestParameter: 'Unexpected token {',\n DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',\n ConstructorSpecialMethod: 'Class constructor may not be an accessor',\n DuplicateConstructor: 'A class may only have one constructor',\n StaticPrototype: 'Classes may not have static property named prototype',\n MissingFromClause: 'Unexpected token',\n NoAsAfterImportNamespace: 'Unexpected token',\n InvalidModuleSpecifier: 'Unexpected token',\n IllegalImportDeclaration: 'Unexpected token',\n IllegalExportDeclaration: 'Unexpected token',\n DuplicateBinding: 'Duplicate binding %0'\n };\n\n // See also tools/generate-unicode-regex.js.\n Regex = {\n // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:\n NonAsciiIdentifierStart: /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2118-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309B-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF30-\\uDF4A\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48]|\\uD804[\\uDC03-\\uDC37\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF5D-\\uDF61]|\\uD805[\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDEC0-\\uDEF8]|\\uD808[\\uDC00-\\uDF98]|\\uD809[\\uDC00-\\uDC6E]|[\\uD80C\\uD840-\\uD868\\uD86A-\\uD86C][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50\\uDF93-\\uDF9F]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD83A[\\uDC00-\\uDCC4]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D]|\\uD87E[\\uDC00-\\uDE1D]/,\n\n // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:\n NonAsciiIdentifierPart: /[\\xAA\\xB5\\xB7\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1369-\\u1371\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19DA\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2118-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDDFD\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDEE0\\uDF00-\\uDF1F\\uDF30-\\uDF4A\\uDF50-\\uDF7A\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCA0-\\uDCA9\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE38-\\uDE3A\\uDE3F\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE6\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48]|\\uD804[\\uDC00-\\uDC46\\uDC66-\\uDC6F\\uDC7F-\\uDCBA\\uDCD0-\\uDCE8\\uDCF0-\\uDCF9\\uDD00-\\uDD34\\uDD36-\\uDD3F\\uDD50-\\uDD73\\uDD76\\uDD80-\\uDDC4\\uDDD0-\\uDDDA\\uDE00-\\uDE11\\uDE13-\\uDE37\\uDEB0-\\uDEEA\\uDEF0-\\uDEF9\\uDF01-\\uDF03\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3C-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF5D-\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74]|\\uD805[\\uDC80-\\uDCC5\\uDCC7\\uDCD0-\\uDCD9\\uDD80-\\uDDB5\\uDDB8-\\uDDC0\\uDE00-\\uDE40\\uDE44\\uDE50-\\uDE59\\uDE80-\\uDEB7\\uDEC0-\\uDEC9]|\\uD806[\\uDCA0-\\uDCE9\\uDCFF\\uDEC0-\\uDEF8]|\\uD808[\\uDC00-\\uDF98]|\\uD809[\\uDC00-\\uDC6E]|[\\uD80C\\uD840-\\uD868\\uD86A-\\uD86C][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE60-\\uDE69\\uDED0-\\uDEED\\uDEF0-\\uDEF4\\uDF00-\\uDF36\\uDF40-\\uDF43\\uDF50-\\uDF59\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50-\\uDF7E\\uDF8F-\\uDF9F]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9D\\uDC9E]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB\\uDFCE-\\uDFFF]|\\uD83A[\\uDC00-\\uDCC4\\uDCD0-\\uDCD6]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D]|\\uD87E[\\uDC00-\\uDE1D]|\\uDB40[\\uDD00-\\uDDEF]/\n };\n\n // Ensure the condition is true, otherwise throw an error.\n // This is only to have a better contract semantic, i.e. another safety net\n // to catch a logic error. The condition shall be fulfilled in normal case.\n // Do NOT use this to enforce a certain condition on any user input.\n\n function assert(condition, message) {\n /* istanbul ignore if */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }\n\n function isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n }\n\n function isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n }\n\n function isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n }\n\n function octalToDecimal(ch) {\n // \\0 is not octal escape sequence\n var octal = (ch !== '0'), code = '01234567'.indexOf(ch);\n\n if (index < length && isOctalDigit(source[index])) {\n octal = true;\n code = code * 8 + '01234567'.indexOf(source[index++]);\n\n // 3 digits are only allowed when string starts\n // with 0, 1, 2, 3\n if ('0123'.indexOf(ch) >= 0 &&\n index < length &&\n isOctalDigit(source[index])) {\n code = code * 8 + '01234567'.indexOf(source[index++]);\n }\n }\n\n return {\n code: code,\n octal: octal\n };\n }\n\n // ECMA-262 11.2 White Space\n\n function isWhiteSpace(ch) {\n return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||\n (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);\n }\n\n // ECMA-262 11.3 Line Terminators\n\n function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }\n\n // ECMA-262 11.6 Identifier Names and Identifiers\n\n function fromCodePoint(cp) {\n return (cp < 0x10000) ? String.fromCharCode(cp) :\n String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +\n String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));\n }\n\n function isIdentifierStart(ch) {\n return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)\n (ch >= 0x41 && ch <= 0x5A) || // A..Z\n (ch >= 0x61 && ch <= 0x7A) || // a..z\n (ch === 0x5C) || // \\ (backslash)\n ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)));\n }\n\n function isIdentifierPart(ch) {\n return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)\n (ch >= 0x41 && ch <= 0x5A) || // A..Z\n (ch >= 0x61 && ch <= 0x7A) || // a..z\n (ch >= 0x30 && ch <= 0x39) || // 0..9\n (ch === 0x5C) || // \\ (backslash)\n ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)));\n }\n\n // ECMA-262 11.6.2.2 Future Reserved Words\n\n function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }\n\n function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }\n\n function isRestrictedWord(id) {\n return id === 'eval' || id === 'arguments';\n }\n\n // ECMA-262 11.6.2.1 Keywords\n\n function isKeyword(id) {\n switch (id.length) {\n case 2:\n return (id === 'if') || (id === 'in') || (id === 'do');\n case 3:\n return (id === 'var') || (id === 'for') || (id === 'new') ||\n (id === 'try') || (id === 'let');\n case 4:\n return (id === 'this') || (id === 'else') || (id === 'case') ||\n (id === 'void') || (id === 'with') || (id === 'enum');\n case 5:\n return (id === 'while') || (id === 'break') || (id === 'catch') ||\n (id === 'throw') || (id === 'const') || (id === 'yield') ||\n (id === 'class') || (id === 'super');\n case 6:\n return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n (id === 'switch') || (id === 'export') || (id === 'import');\n case 7:\n return (id === 'default') || (id === 'finally') || (id === 'extends');\n case 8:\n return (id === 'function') || (id === 'continue') || (id === 'debugger');\n case 10:\n return (id === 'instanceof');\n default:\n return false;\n }\n }\n\n // ECMA-262 11.4 Comments\n\n function addComment(type, value, start, end, loc) {\n var comment;\n\n assert(typeof start === 'number', 'Comment must have valid position');\n\n state.lastCommentStart = start;\n\n comment = {\n type: type,\n value: value\n };\n if (extra.range) {\n comment.range = [start, end];\n }\n if (extra.loc) {\n comment.loc = loc;\n }\n extra.comments.push(comment);\n if (extra.attachComment) {\n extra.leadingComments.push(comment);\n extra.trailingComments.push(comment);\n }\n if (extra.tokenize) {\n comment.type = comment.type + 'Comment';\n if (extra.delegate) {\n comment = extra.delegate(comment);\n }\n extra.tokens.push(comment);\n }\n }\n\n function skipSingleLineComment(offset) {\n var start, loc, ch, comment;\n\n start = index - offset;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart - offset\n }\n };\n\n while (index < length) {\n ch = source.charCodeAt(index);\n ++index;\n if (isLineTerminator(ch)) {\n hasLineTerminator = true;\n if (extra.comments) {\n comment = source.slice(start + offset, index - 1);\n loc.end = {\n line: lineNumber,\n column: index - lineStart - 1\n };\n addComment('Line', comment, start, index - 1, loc);\n }\n if (ch === 13 && source.charCodeAt(index) === 10) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n return;\n }\n }\n\n if (extra.comments) {\n comment = source.slice(start + offset, index);\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n addComment('Line', comment, start, index, loc);\n }\n }\n\n function skipMultiLineComment() {\n var start, loc, ch, comment;\n\n if (extra.comments) {\n start = index - 2;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart - 2\n }\n };\n }\n\n while (index < length) {\n ch = source.charCodeAt(index);\n if (isLineTerminator(ch)) {\n if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) {\n ++index;\n }\n hasLineTerminator = true;\n ++lineNumber;\n ++index;\n lineStart = index;\n } else if (ch === 0x2A) {\n // Block comment ends with '*/'.\n if (source.charCodeAt(index + 1) === 0x2F) {\n ++index;\n ++index;\n if (extra.comments) {\n comment = source.slice(start + 2, index - 2);\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n addComment('Block', comment, start, index, loc);\n }\n return;\n }\n ++index;\n } else {\n ++index;\n }\n }\n\n // Ran off the end of the file - the whole thing is a comment\n if (extra.comments) {\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n comment = source.slice(start + 2, index);\n addComment('Block', comment, start, index, loc);\n }\n tolerateUnexpectedToken();\n }\n\n function skipComment() {\n var ch, start;\n hasLineTerminator = false;\n\n start = (index === 0);\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch)) {\n ++index;\n } else if (isLineTerminator(ch)) {\n hasLineTerminator = true;\n ++index;\n if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n start = true;\n } else if (ch === 0x2F) { // U+002F is '/'\n ch = source.charCodeAt(index + 1);\n if (ch === 0x2F) {\n ++index;\n ++index;\n skipSingleLineComment(2);\n start = true;\n } else if (ch === 0x2A) { // U+002A is '*'\n ++index;\n ++index;\n skipMultiLineComment();\n } else {\n break;\n }\n } else if (start && ch === 0x2D) { // U+002D is '-'\n // U+003E is '>'\n if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) {\n // '-->' is a single-line comment\n index += 3;\n skipSingleLineComment(3);\n } else {\n break;\n }\n } else if (ch === 0x3C) { // U+003C is '<'\n if (source.slice(index + 1, index + 4) === '!--') {\n ++index; // `<`\n ++index; // `!`\n ++index; // `-`\n ++index; // `-`\n skipSingleLineComment(4);\n } else {\n break;\n }\n } else {\n break;\n }\n }\n }\n\n function scanHexEscape(prefix) {\n var i, len, ch, code = 0;\n\n len = (prefix === 'u') ? 4 : 2;\n for (i = 0; i < len; ++i) {\n if (index < length && isHexDigit(source[index])) {\n ch = source[index++];\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n } else {\n return '';\n }\n }\n return String.fromCharCode(code);\n }\n\n function scanUnicodeCodePointEscape() {\n var ch, code;\n\n ch = source[index];\n code = 0;\n\n // At least, one hex digit is required.\n if (ch === '}') {\n throwUnexpectedToken();\n }\n\n while (index < length) {\n ch = source[index++];\n if (!isHexDigit(ch)) {\n break;\n }\n code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());\n }\n\n if (code > 0x10FFFF || ch !== '}') {\n throwUnexpectedToken();\n }\n\n return fromCodePoint(code);\n }\n\n function codePointAt(i) {\n var cp, first, second;\n\n cp = source.charCodeAt(i);\n if (cp >= 0xD800 && cp <= 0xDBFF) {\n second = source.charCodeAt(i + 1);\n if (second >= 0xDC00 && second <= 0xDFFF) {\n first = cp;\n cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n }\n }\n\n return cp;\n }\n\n function getComplexIdentifier() {\n var cp, ch, id;\n\n cp = codePointAt(index);\n id = fromCodePoint(cp);\n index += id.length;\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (cp === 0x5C) {\n if (source.charCodeAt(index) !== 0x75) {\n throwUnexpectedToken();\n }\n ++index;\n if (source[index] === '{') {\n ++index;\n ch = scanUnicodeCodePointEscape();\n } else {\n ch = scanHexEscape('u');\n cp = ch.charCodeAt(0);\n if (!ch || ch === '\\\\' || !isIdentifierStart(cp)) {\n throwUnexpectedToken();\n }\n }\n id = ch;\n }\n\n while (index < length) {\n cp = codePointAt(index);\n if (!isIdentifierPart(cp)) {\n break;\n }\n ch = fromCodePoint(cp);\n id += ch;\n index += ch.length;\n\n // '\\u' (U+005C, U+0075) denotes an escaped character.\n if (cp === 0x5C) {\n id = id.substr(0, id.length - 1);\n if (source.charCodeAt(index) !== 0x75) {\n throwUnexpectedToken();\n }\n ++index;\n if (source[index] === '{') {\n ++index;\n ch = scanUnicodeCodePointEscape();\n } else {\n ch = scanHexEscape('u');\n cp = ch.charCodeAt(0);\n if (!ch || ch === '\\\\' || !isIdentifierPart(cp)) {\n throwUnexpectedToken();\n }\n }\n id += ch;\n }\n }\n\n return id;\n }\n\n function getIdentifier() {\n var start, ch;\n\n start = index++;\n while (index < length) {\n ch = source.charCodeAt(index);\n if (ch === 0x5C) {\n // Blackslash (U+005C) marks Unicode escape sequence.\n index = start;\n return getComplexIdentifier();\n } else if (ch >= 0xD800 && ch < 0xDFFF) {\n // Need to handle surrogate pairs.\n index = start;\n return getComplexIdentifier();\n }\n if (isIdentifierPart(ch)) {\n ++index;\n } else {\n break;\n }\n }\n\n return source.slice(start, index);\n }\n\n function scanIdentifier() {\n var start, id, type;\n\n start = index;\n\n // Backslash (U+005C) starts an escaped character.\n id = (source.charCodeAt(index) === 0x5C) ? getComplexIdentifier() : getIdentifier();\n\n // There is no keyword or literal with only one character.\n // Thus, it must be an identifier.\n if (id.length === 1) {\n type = Token.Identifier;\n } else if (isKeyword(id)) {\n type = Token.Keyword;\n } else if (id === 'null') {\n type = Token.NullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = Token.BooleanLiteral;\n } else {\n type = Token.Identifier;\n }\n\n return {\n type: type,\n value: id,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n\n // ECMA-262 11.7 Punctuators\n\n function scanPunctuator() {\n var token, str;\n\n token = {\n type: Token.Punctuator,\n value: '',\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: index,\n end: index\n };\n\n // Check for most common single-character punctuators.\n str = source[index];\n switch (str) {\n\n case '(':\n if (extra.tokenize) {\n extra.openParenToken = extra.tokenValues.length;\n }\n ++index;\n break;\n\n case '{':\n if (extra.tokenize) {\n extra.openCurlyToken = extra.tokenValues.length;\n }\n state.curlyStack.push('{');\n ++index;\n break;\n\n case '.':\n ++index;\n if (source[index] === '.' && source[index + 1] === '.') {\n // Spread operator: ...\n index += 2;\n str = '...';\n }\n break;\n\n case '}':\n ++index;\n state.curlyStack.pop();\n break;\n case ')':\n case ';':\n case ',':\n case '[':\n case ']':\n case ':':\n case '?':\n case '~':\n ++index;\n break;\n\n default:\n // 4-character punctuator.\n str = source.substr(index, 4);\n if (str === '>>>=') {\n index += 4;\n } else {\n\n // 3-character punctuators.\n str = str.substr(0, 3);\n if (str === '===' || str === '!==' || str === '>>>' ||\n str === '<<=' || str === '>>=') {\n index += 3;\n } else {\n\n // 2-character punctuators.\n str = str.substr(0, 2);\n if (str === '&&' || str === '||' || str === '==' || str === '!=' ||\n str === '+=' || str === '-=' || str === '*=' || str === '/=' ||\n str === '++' || str === '--' || str === '<<' || str === '>>' ||\n str === '&=' || str === '|=' || str === '^=' || str === '%=' ||\n str === '<=' || str === '>=' || str === '=>') {\n index += 2;\n } else {\n\n // 1-character punctuators.\n str = source[index];\n if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {\n ++index;\n }\n }\n }\n }\n }\n\n if (index === token.start) {\n throwUnexpectedToken();\n }\n\n token.end = index;\n token.value = str;\n return token;\n }\n\n // ECMA-262 11.8.3 Numeric Literals\n\n function scanHexLiteral(start) {\n var number = '';\n\n while (index < length) {\n if (!isHexDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n\n if (number.length === 0) {\n throwUnexpectedToken();\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwUnexpectedToken();\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt('0x' + number, 16),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function scanBinaryLiteral(start) {\n var ch, number;\n\n number = '';\n\n while (index < length) {\n ch = source[index];\n if (ch !== '0' && ch !== '1') {\n break;\n }\n number += source[index++];\n }\n\n if (number.length === 0) {\n // only 0b or 0B\n throwUnexpectedToken();\n }\n\n if (index < length) {\n ch = source.charCodeAt(index);\n /* istanbul ignore else */\n if (isIdentifierStart(ch) || isDecimalDigit(ch)) {\n throwUnexpectedToken();\n }\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 2),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function scanOctalLiteral(prefix, start) {\n var number, octal;\n\n if (isOctalDigit(prefix)) {\n octal = true;\n number = '0' + source[index++];\n } else {\n octal = false;\n ++index;\n number = '';\n }\n\n while (index < length) {\n if (!isOctalDigit(source[index])) {\n break;\n }\n number += source[index++];\n }\n\n if (!octal && number.length === 0) {\n // only 0o or 0O\n throwUnexpectedToken();\n }\n\n if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {\n throwUnexpectedToken();\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 8),\n octal: octal,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function isImplicitOctalLiteral() {\n var i, ch;\n\n // Implicit octal, unless there is a non-octal digit.\n // (Annex B.1.1 on Numeric Literals)\n for (i = index + 1; i < length; ++i) {\n ch = source[i];\n if (ch === '8' || ch === '9') {\n return false;\n }\n if (!isOctalDigit(ch)) {\n return true;\n }\n }\n\n return true;\n }\n\n function scanNumericLiteral() {\n var number, start, ch;\n\n ch = source[index];\n assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),\n 'Numeric literal must start with a decimal digit or a decimal point');\n\n start = index;\n number = '';\n if (ch !== '.') {\n number = source[index++];\n ch = source[index];\n\n // Hex number starts with '0x'.\n // Octal number starts with '0'.\n // Octal number in ES6 starts with '0o'.\n // Binary number in ES6 starts with '0b'.\n if (number === '0') {\n if (ch === 'x' || ch === 'X') {\n ++index;\n return scanHexLiteral(start);\n }\n if (ch === 'b' || ch === 'B') {\n ++index;\n return scanBinaryLiteral(start);\n }\n if (ch === 'o' || ch === 'O') {\n return scanOctalLiteral(ch, start);\n }\n\n if (isOctalDigit(ch)) {\n if (isImplicitOctalLiteral()) {\n return scanOctalLiteral(ch, start);\n }\n }\n }\n\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n\n if (ch === '.') {\n number += source[index++];\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n ch = source[index];\n }\n\n if (ch === 'e' || ch === 'E') {\n number += source[index++];\n\n ch = source[index];\n if (ch === '+' || ch === '-') {\n number += source[index++];\n }\n if (isDecimalDigit(source.charCodeAt(index))) {\n while (isDecimalDigit(source.charCodeAt(index))) {\n number += source[index++];\n }\n } else {\n throwUnexpectedToken();\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwUnexpectedToken();\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseFloat(number),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // ECMA-262 11.8.4 String Literals\n\n function scanStringLiteral() {\n var str = '', quote, start, ch, unescaped, octToDec, octal = false;\n\n quote = source[index];\n assert((quote === '\\'' || quote === '\"'),\n 'String literal must starts with a quote');\n\n start = index;\n ++index;\n\n while (index < length) {\n ch = source[index++];\n\n if (ch === quote) {\n quote = '';\n break;\n } else if (ch === '\\\\') {\n ch = source[index++];\n if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n switch (ch) {\n case 'u':\n case 'x':\n if (source[index] === '{') {\n ++index;\n str += scanUnicodeCodePointEscape();\n } else {\n unescaped = scanHexEscape(ch);\n if (!unescaped) {\n throw throwUnexpectedToken();\n }\n str += unescaped;\n }\n break;\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n case '8':\n case '9':\n str += ch;\n tolerateUnexpectedToken();\n break;\n\n default:\n if (isOctalDigit(ch)) {\n octToDec = octalToDecimal(ch);\n\n octal = octToDec.octal || octal;\n str += String.fromCharCode(octToDec.code);\n } else {\n str += ch;\n }\n break;\n }\n } else {\n ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwUnexpectedToken();\n }\n\n return {\n type: Token.StringLiteral,\n value: str,\n octal: octal,\n lineNumber: startLineNumber,\n lineStart: startLineStart,\n start: start,\n end: index\n };\n }\n\n // ECMA-262 11.8.6 Template Literal Lexical Components\n\n function scanTemplate() {\n var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;\n\n terminated = false;\n tail = false;\n start = index;\n head = (source[index] === '`');\n rawOffset = 2;\n\n ++index;\n\n while (index < length) {\n ch = source[index++];\n if (ch === '`') {\n rawOffset = 1;\n tail = true;\n terminated = true;\n break;\n } else if (ch === '$') {\n if (source[index] === '{') {\n state.curlyStack.push('${');\n ++index;\n terminated = true;\n break;\n }\n cooked += ch;\n } else if (ch === '\\\\') {\n ch = source[index++];\n if (!isLineTerminator(ch.charCodeAt(0))) {\n switch (ch) {\n case 'n':\n cooked += '\\n';\n break;\n case 'r':\n cooked += '\\r';\n break;\n case 't':\n cooked += '\\t';\n break;\n case 'u':\n case 'x':\n if (source[index] === '{') {\n ++index;\n cooked += scanUnicodeCodePointEscape();\n } else {\n restore = index;\n unescaped = scanHexEscape(ch);\n if (unescaped) {\n cooked += unescaped;\n } else {\n index = restore;\n cooked += ch;\n }\n }\n break;\n case 'b':\n cooked += '\\b';\n break;\n case 'f':\n cooked += '\\f';\n break;\n case 'v':\n cooked += '\\v';\n break;\n\n default:\n if (ch === '0') {\n if (isDecimalDigit(source.charCodeAt(index))) {\n // Illegal: \\01 \\02 and so on\n throwError(Messages.TemplateOctalLiteral);\n }\n cooked += '\\0';\n } else if (isOctalDigit(ch)) {\n // Illegal: \\1 \\2\n throwError(Messages.TemplateOctalLiteral);\n } else {\n cooked += ch;\n }\n break;\n }\n } else {\n ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n cooked += '\\n';\n } else {\n cooked += ch;\n }\n }\n\n if (!terminated) {\n throwUnexpectedToken();\n }\n\n if (!head) {\n state.curlyStack.pop();\n }\n\n return {\n type: Token.Template,\n value: {\n cooked: cooked,\n raw: source.slice(start + 1, index - rawOffset)\n },\n head: head,\n tail: tail,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // ECMA-262 11.8.5 Regular Expression Literals\n\n function testRegExp(pattern, flags) {\n // The BMP character to use as a replacement for astral symbols when\n // translating an ES6 \"u\"-flagged pattern to an ES5-compatible\n // approximation.\n // Note: replacing with '\\uFFFF' enables false positives in unlikely\n // scenarios. For example, `[\\u{1044f}-\\u{10440}]` is an invalid\n // pattern that would not be detected by this substitution.\n var astralSubstitute = '\\uFFFF',\n tmp = pattern;\n\n if (flags.indexOf('u') >= 0) {\n tmp = tmp\n // Replace every Unicode escape sequence with the equivalent\n // BMP character or a constant ASCII code point in the case of\n // astral symbols. (See the above note on `astralSubstitute`\n // for more information.)\n .replace(/\\\\u\\{([0-9a-fA-F]+)\\}|\\\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {\n var codePoint = parseInt($1 || $2, 16);\n if (codePoint > 0x10FFFF) {\n throwUnexpectedToken(null, Messages.InvalidRegExp);\n }\n if (codePoint <= 0xFFFF) {\n return String.fromCharCode(codePoint);\n }\n return astralSubstitute;\n })\n // Replace each paired surrogate with a single ASCII symbol to\n // avoid throwing on regular expressions that are only valid in\n // combination with the \"u\" flag.\n .replace(\n /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n astralSubstitute\n );\n }\n\n // First, detect invalid regular expressions.\n try {\n RegExp(tmp);\n } catch (e) {\n throwUnexpectedToken(null, Messages.InvalidRegExp);\n }\n\n // Return a regular expression object for this pattern-flag pair, or\n // `null` in case the current environment doesn't support the flags it\n // uses.\n try {\n return new RegExp(pattern, flags);\n } catch (exception) {\n return null;\n }\n }\n\n function scanRegExpBody() {\n var ch, str, classMarker, terminated, body;\n\n ch = source[index];\n assert(ch === '/', 'Regular expression literal must start with a slash');\n str = source[index++];\n\n classMarker = false;\n terminated = false;\n while (index < length) {\n ch = source[index++];\n str += ch;\n if (ch === '\\\\') {\n ch = source[index++];\n // ECMA-262 7.8.5\n if (isLineTerminator(ch.charCodeAt(0))) {\n throwUnexpectedToken(null, Messages.UnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwUnexpectedToken(null, Messages.UnterminatedRegExp);\n } else if (classMarker) {\n if (ch === ']') {\n classMarker = false;\n }\n } else {\n if (ch === '/') {\n terminated = true;\n break;\n } else if (ch === '[') {\n classMarker = true;\n }\n }\n }\n\n if (!terminated) {\n throwUnexpectedToken(null, Messages.UnterminatedRegExp);\n }\n\n // Exclude leading and trailing slash.\n body = str.substr(1, str.length - 2);\n return {\n value: body,\n literal: str\n };\n }\n\n function scanRegExpFlags() {\n var ch, str, flags, restore;\n\n str = '';\n flags = '';\n while (index < length) {\n ch = source[index];\n if (!isIdentifierPart(ch.charCodeAt(0))) {\n break;\n }\n\n ++index;\n if (ch === '\\\\' && index < length) {\n ch = source[index];\n if (ch === 'u') {\n ++index;\n restore = index;\n ch = scanHexEscape('u');\n if (ch) {\n flags += ch;\n for (str += '\\\\u'; restore < index; ++restore) {\n str += source[restore];\n }\n } else {\n index = restore;\n flags += 'u';\n str += '\\\\u';\n }\n tolerateUnexpectedToken();\n } else {\n str += '\\\\';\n tolerateUnexpectedToken();\n }\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n return {\n value: flags,\n literal: str\n };\n }\n\n function scanRegExp() {\n var start, body, flags, value;\n scanning = true;\n\n lookahead = null;\n skipComment();\n start = index;\n\n body = scanRegExpBody();\n flags = scanRegExpFlags();\n value = testRegExp(body.value, flags.value);\n scanning = false;\n if (extra.tokenize) {\n return {\n type: Token.RegularExpression,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n return {\n literal: body.literal + flags.literal,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n start: start,\n end: index\n };\n }\n\n function collectRegex() {\n var pos, loc, regex, token;\n\n skipComment();\n\n pos = index;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n regex = scanRegExp();\n\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n /* istanbul ignore next */\n if (!extra.tokenize) {\n // Pop the previous token, which is likely '/' or '/='\n if (extra.tokens.length > 0) {\n token = extra.tokens[extra.tokens.length - 1];\n if (token.range[0] === pos && token.type === 'Punctuator') {\n if (token.value === '/' || token.value === '/=') {\n extra.tokens.pop();\n }\n }\n }\n\n extra.tokens.push({\n type: 'RegularExpression',\n value: regex.literal,\n regex: regex.regex,\n range: [pos, index],\n loc: loc\n });\n }\n\n return regex;\n }\n\n function isIdentifierName(token) {\n return token.type === Token.Identifier ||\n token.type === Token.Keyword ||\n token.type === Token.BooleanLiteral ||\n token.type === Token.NullLiteral;\n }\n\n // Using the following algorithm:\n // https://github.com/mozilla/sweet.js/wiki/design\n\n function advanceSlash() {\n var regex, previous, check;\n\n function testKeyword(value) {\n return value && (value.length > 1) && (value[0] >= 'a') && (value[0] <= 'z');\n }\n\n previous = extra.tokenValues[extra.tokens.length - 1];\n regex = (previous !== null);\n\n switch (previous) {\n case 'this':\n case ']':\n regex = false;\n break;\n\n case ')':\n check = extra.tokenValues[extra.openParenToken - 1];\n regex = (check === 'if' || check === 'while' || check === 'for' || check === 'with');\n break;\n\n case '}':\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n regex = false;\n if (testKeyword(extra.tokenValues[extra.openCurlyToken - 3])) {\n // Anonymous function, e.g. function(){} /42\n check = extra.tokenValues[extra.openCurlyToken - 4];\n regex = check ? (FnExprTokens.indexOf(check) < 0) : false;\n } else if (testKeyword(extra.tokenValues[extra.openCurlyToken - 4])) {\n // Named function, e.g. function f(){} /42/\n check = extra.tokenValues[extra.openCurlyToken - 5];\n regex = check ? (FnExprTokens.indexOf(check) < 0) : true;\n }\n }\n\n return regex ? collectRegex() : scanPunctuator();\n }\n\n function advance() {\n var cp, token;\n\n if (index >= length) {\n return {\n type: Token.EOF,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: index,\n end: index\n };\n }\n\n cp = source.charCodeAt(index);\n\n if (isIdentifierStart(cp)) {\n token = scanIdentifier();\n if (strict && isStrictModeReservedWord(token.value)) {\n token.type = Token.Keyword;\n }\n return token;\n }\n\n // Very common: ( and ) and ;\n if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {\n return scanPunctuator();\n }\n\n // String literal starts with single quote (U+0027) or double quote (U+0022).\n if (cp === 0x27 || cp === 0x22) {\n return scanStringLiteral();\n }\n\n // Dot (.) U+002E can also start a floating-point number, hence the need\n // to check the next character.\n if (cp === 0x2E) {\n if (isDecimalDigit(source.charCodeAt(index + 1))) {\n return scanNumericLiteral();\n }\n return scanPunctuator();\n }\n\n if (isDecimalDigit(cp)) {\n return scanNumericLiteral();\n }\n\n // Slash (/) U+002F can also start a regex.\n if (extra.tokenize && cp === 0x2F) {\n return advanceSlash();\n }\n\n // Template literals start with ` (U+0060) for template head\n // or } (U+007D) for template middle or template tail.\n if (cp === 0x60 || (cp === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) {\n return scanTemplate();\n }\n\n // Possible identifier start in a surrogate pair.\n if (cp >= 0xD800 && cp < 0xDFFF) {\n cp = codePointAt(index);\n if (isIdentifierStart(cp)) {\n return scanIdentifier();\n }\n }\n\n return scanPunctuator();\n }\n\n function collectToken() {\n var loc, token, value, entry;\n\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n token = advance();\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (token.type !== Token.EOF) {\n value = source.slice(token.start, token.end);\n entry = {\n type: TokenName[token.type],\n value: value,\n range: [token.start, token.end],\n loc: loc\n };\n if (token.regex) {\n entry.regex = {\n pattern: token.regex.pattern,\n flags: token.regex.flags\n };\n }\n if (extra.tokenValues) {\n extra.tokenValues.push((entry.type === 'Punctuator' || entry.type === 'Keyword') ? entry.value : null);\n }\n if (extra.tokenize) {\n if (!extra.range) {\n delete entry.range;\n }\n if (!extra.loc) {\n delete entry.loc;\n }\n if (extra.delegate) {\n entry = extra.delegate(entry);\n }\n }\n extra.tokens.push(entry);\n }\n\n return token;\n }\n\n function lex() {\n var token;\n scanning = true;\n\n lastIndex = index;\n lastLineNumber = lineNumber;\n lastLineStart = lineStart;\n\n skipComment();\n\n token = lookahead;\n\n startIndex = index;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n scanning = false;\n return token;\n }\n\n function peek() {\n scanning = true;\n\n skipComment();\n\n lastIndex = index;\n lastLineNumber = lineNumber;\n lastLineStart = lineStart;\n\n startIndex = index;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n scanning = false;\n }\n\n function Position() {\n this.line = startLineNumber;\n this.column = startIndex - startLineStart;\n }\n\n function SourceLocation() {\n this.start = new Position();\n this.end = null;\n }\n\n function WrappingSourceLocation(startToken) {\n this.start = {\n line: startToken.lineNumber,\n column: startToken.start - startToken.lineStart\n };\n this.end = null;\n }\n\n function Node() {\n if (extra.range) {\n this.range = [startIndex, 0];\n }\n if (extra.loc) {\n this.loc = new SourceLocation();\n }\n }\n\n function WrappingNode(startToken) {\n if (extra.range) {\n this.range = [startToken.start, 0];\n }\n if (extra.loc) {\n this.loc = new WrappingSourceLocation(startToken);\n }\n }\n\n WrappingNode.prototype = Node.prototype = {\n\n processComment: function () {\n var lastChild,\n innerComments,\n leadingComments,\n trailingComments,\n bottomRight = extra.bottomRightStack,\n i,\n comment,\n last = bottomRight[bottomRight.length - 1];\n\n if (this.type === Syntax.Program) {\n if (this.body.length > 0) {\n return;\n }\n }\n /**\n * patch innnerComments for properties empty block\n * `function a() {/** comments **\\/}`\n */\n\n if (this.type === Syntax.BlockStatement && this.body.length === 0) {\n innerComments = [];\n for (i = extra.leadingComments.length - 1; i >= 0; --i) {\n comment = extra.leadingComments[i];\n if (this.range[1] >= comment.range[1]) {\n innerComments.unshift(comment);\n extra.leadingComments.splice(i, 1);\n extra.trailingComments.splice(i, 1);\n }\n }\n if (innerComments.length) {\n this.innerComments = innerComments;\n //bottomRight.push(this);\n return;\n }\n }\n\n if (extra.trailingComments.length > 0) {\n trailingComments = [];\n for (i = extra.trailingComments.length - 1; i >= 0; --i) {\n comment = extra.trailingComments[i];\n if (comment.range[0] >= this.range[1]) {\n trailingComments.unshift(comment);\n extra.trailingComments.splice(i, 1);\n }\n }\n extra.trailingComments = [];\n } else {\n if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) {\n trailingComments = last.trailingComments;\n delete last.trailingComments;\n }\n }\n\n // Eating the stack.\n while (last && last.range[0] >= this.range[0]) {\n lastChild = bottomRight.pop();\n last = bottomRight[bottomRight.length - 1];\n }\n\n if (lastChild) {\n if (lastChild.leadingComments) {\n leadingComments = [];\n for (i = lastChild.leadingComments.length - 1; i >= 0; --i) {\n comment = lastChild.leadingComments[i];\n if (comment.range[1] <= this.range[0]) {\n leadingComments.unshift(comment);\n lastChild.leadingComments.splice(i, 1);\n }\n }\n\n if (!lastChild.leadingComments.length) {\n lastChild.leadingComments = undefined;\n }\n }\n } else if (extra.leadingComments.length > 0) {\n leadingComments = [];\n for (i = extra.leadingComments.length - 1; i >= 0; --i) {\n comment = extra.leadingComments[i];\n if (comment.range[1] <= this.range[0]) {\n leadingComments.unshift(comment);\n extra.leadingComments.splice(i, 1);\n }\n }\n }\n\n\n if (leadingComments && leadingComments.length > 0) {\n this.leadingComments = leadingComments;\n }\n if (trailingComments && trailingComments.length > 0) {\n this.trailingComments = trailingComments;\n }\n\n bottomRight.push(this);\n },\n\n finish: function () {\n if (extra.range) {\n this.range[1] = lastIndex;\n }\n if (extra.loc) {\n this.loc.end = {\n line: lastLineNumber,\n column: lastIndex - lastLineStart\n };\n if (extra.source) {\n this.loc.source = extra.source;\n }\n }\n\n if (extra.attachComment) {\n this.processComment();\n }\n },\n\n finishArrayExpression: function (elements) {\n this.type = Syntax.ArrayExpression;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishArrayPattern: function (elements) {\n this.type = Syntax.ArrayPattern;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishArrowFunctionExpression: function (params, defaults, body, expression) {\n this.type = Syntax.ArrowFunctionExpression;\n this.id = null;\n this.params = params;\n this.defaults = defaults;\n this.body = body;\n this.generator = false;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishAssignmentExpression: function (operator, left, right) {\n this.type = Syntax.AssignmentExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishAssignmentPattern: function (left, right) {\n this.type = Syntax.AssignmentPattern;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBinaryExpression: function (operator, left, right) {\n this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBlockStatement: function (body) {\n this.type = Syntax.BlockStatement;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishBreakStatement: function (label) {\n this.type = Syntax.BreakStatement;\n this.label = label;\n this.finish();\n return this;\n },\n\n finishCallExpression: function (callee, args) {\n this.type = Syntax.CallExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishCatchClause: function (param, body) {\n this.type = Syntax.CatchClause;\n this.param = param;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishClassBody: function (body) {\n this.type = Syntax.ClassBody;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishClassDeclaration: function (id, superClass, body) {\n this.type = Syntax.ClassDeclaration;\n this.id = id;\n this.superClass = superClass;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishClassExpression: function (id, superClass, body) {\n this.type = Syntax.ClassExpression;\n this.id = id;\n this.superClass = superClass;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishConditionalExpression: function (test, consequent, alternate) {\n this.type = Syntax.ConditionalExpression;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishContinueStatement: function (label) {\n this.type = Syntax.ContinueStatement;\n this.label = label;\n this.finish();\n return this;\n },\n\n finishDebuggerStatement: function () {\n this.type = Syntax.DebuggerStatement;\n this.finish();\n return this;\n },\n\n finishDoWhileStatement: function (body, test) {\n this.type = Syntax.DoWhileStatement;\n this.body = body;\n this.test = test;\n this.finish();\n return this;\n },\n\n finishEmptyStatement: function () {\n this.type = Syntax.EmptyStatement;\n this.finish();\n return this;\n },\n\n finishExpressionStatement: function (expression) {\n this.type = Syntax.ExpressionStatement;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishForStatement: function (init, test, update, body) {\n this.type = Syntax.ForStatement;\n this.init = init;\n this.test = test;\n this.update = update;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishForOfStatement: function (left, right, body) {\n this.type = Syntax.ForOfStatement;\n this.left = left;\n this.right = right;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishForInStatement: function (left, right, body) {\n this.type = Syntax.ForInStatement;\n this.left = left;\n this.right = right;\n this.body = body;\n this.each = false;\n this.finish();\n return this;\n },\n\n finishFunctionDeclaration: function (id, params, defaults, body, generator) {\n this.type = Syntax.FunctionDeclaration;\n this.id = id;\n this.params = params;\n this.defaults = defaults;\n this.body = body;\n this.generator = generator;\n this.expression = false;\n this.finish();\n return this;\n },\n\n finishFunctionExpression: function (id, params, defaults, body, generator) {\n this.type = Syntax.FunctionExpression;\n this.id = id;\n this.params = params;\n this.defaults = defaults;\n this.body = body;\n this.generator = generator;\n this.expression = false;\n this.finish();\n return this;\n },\n\n finishIdentifier: function (name) {\n this.type = Syntax.Identifier;\n this.name = name;\n this.finish();\n return this;\n },\n\n finishIfStatement: function (test, consequent, alternate) {\n this.type = Syntax.IfStatement;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishLabeledStatement: function (label, body) {\n this.type = Syntax.LabeledStatement;\n this.label = label;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishLiteral: function (token) {\n this.type = Syntax.Literal;\n this.value = token.value;\n this.raw = source.slice(token.start, token.end);\n if (token.regex) {\n this.regex = token.regex;\n }\n this.finish();\n return this;\n },\n\n finishMemberExpression: function (accessor, object, property) {\n this.type = Syntax.MemberExpression;\n this.computed = accessor === '[';\n this.object = object;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishMetaProperty: function (meta, property) {\n this.type = Syntax.MetaProperty;\n this.meta = meta;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishNewExpression: function (callee, args) {\n this.type = Syntax.NewExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishObjectExpression: function (properties) {\n this.type = Syntax.ObjectExpression;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishObjectPattern: function (properties) {\n this.type = Syntax.ObjectPattern;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishPostfixExpression: function (operator, argument) {\n this.type = Syntax.UpdateExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = false;\n this.finish();\n return this;\n },\n\n finishProgram: function (body, sourceType) {\n this.type = Syntax.Program;\n this.body = body;\n this.sourceType = sourceType;\n this.finish();\n return this;\n },\n\n finishProperty: function (kind, key, computed, value, method, shorthand) {\n this.type = Syntax.Property;\n this.key = key;\n this.computed = computed;\n this.value = value;\n this.kind = kind;\n this.method = method;\n this.shorthand = shorthand;\n this.finish();\n return this;\n },\n\n finishRestElement: function (argument) {\n this.type = Syntax.RestElement;\n this.argument = argument;\n this.finish();\n return this;\n },\n\n finishReturnStatement: function (argument) {\n this.type = Syntax.ReturnStatement;\n this.argument = argument;\n this.finish();\n return this;\n },\n\n finishSequenceExpression: function (expressions) {\n this.type = Syntax.SequenceExpression;\n this.expressions = expressions;\n this.finish();\n return this;\n },\n\n finishSpreadElement: function (argument) {\n this.type = Syntax.SpreadElement;\n this.argument = argument;\n this.finish();\n return this;\n },\n\n finishSwitchCase: function (test, consequent) {\n this.type = Syntax.SwitchCase;\n this.test = test;\n this.consequent = consequent;\n this.finish();\n return this;\n },\n\n finishSuper: function () {\n this.type = Syntax.Super;\n this.finish();\n return this;\n },\n\n finishSwitchStatement: function (discriminant, cases) {\n this.type = Syntax.SwitchStatement;\n this.discriminant = discriminant;\n this.cases = cases;\n this.finish();\n return this;\n },\n\n finishTaggedTemplateExpression: function (tag, quasi) {\n this.type = Syntax.TaggedTemplateExpression;\n this.tag = tag;\n this.quasi = quasi;\n this.finish();\n return this;\n },\n\n finishTemplateElement: function (value, tail) {\n this.type = Syntax.TemplateElement;\n this.value = value;\n this.tail = tail;\n this.finish();\n return this;\n },\n\n finishTemplateLiteral: function (quasis, expressions) {\n this.type = Syntax.TemplateLiteral;\n this.quasis = quasis;\n this.expressions = expressions;\n this.finish();\n return this;\n },\n\n finishThisExpression: function () {\n this.type = Syntax.ThisExpression;\n this.finish();\n return this;\n },\n\n finishThrowStatement: function (argument) {\n this.type = Syntax.ThrowStatement;\n this.argument = argument;\n this.finish();\n return this;\n },\n\n finishTryStatement: function (block, handler, finalizer) {\n this.type = Syntax.TryStatement;\n this.block = block;\n this.guardedHandlers = [];\n this.handlers = handler ? [handler] : [];\n this.handler = handler;\n this.finalizer = finalizer;\n this.finish();\n return this;\n },\n\n finishUnaryExpression: function (operator, argument) {\n this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = true;\n this.finish();\n return this;\n },\n\n finishVariableDeclaration: function (declarations) {\n this.type = Syntax.VariableDeclaration;\n this.declarations = declarations;\n this.kind = 'var';\n this.finish();\n return this;\n },\n\n finishLexicalDeclaration: function (declarations, kind) {\n this.type = Syntax.VariableDeclaration;\n this.declarations = declarations;\n this.kind = kind;\n this.finish();\n return this;\n },\n\n finishVariableDeclarator: function (id, init) {\n this.type = Syntax.VariableDeclarator;\n this.id = id;\n this.init = init;\n this.finish();\n return this;\n },\n\n finishWhileStatement: function (test, body) {\n this.type = Syntax.WhileStatement;\n this.test = test;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishWithStatement: function (object, body) {\n this.type = Syntax.WithStatement;\n this.object = object;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishExportSpecifier: function (local, exported) {\n this.type = Syntax.ExportSpecifier;\n this.exported = exported || local;\n this.local = local;\n this.finish();\n return this;\n },\n\n finishImportDefaultSpecifier: function (local) {\n this.type = Syntax.ImportDefaultSpecifier;\n this.local = local;\n this.finish();\n return this;\n },\n\n finishImportNamespaceSpecifier: function (local) {\n this.type = Syntax.ImportNamespaceSpecifier;\n this.local = local;\n this.finish();\n return this;\n },\n\n finishExportNamedDeclaration: function (declaration, specifiers, src) {\n this.type = Syntax.ExportNamedDeclaration;\n this.declaration = declaration;\n this.specifiers = specifiers;\n this.source = src;\n this.finish();\n return this;\n },\n\n finishExportDefaultDeclaration: function (declaration) {\n this.type = Syntax.ExportDefaultDeclaration;\n this.declaration = declaration;\n this.finish();\n return this;\n },\n\n finishExportAllDeclaration: function (src) {\n this.type = Syntax.ExportAllDeclaration;\n this.source = src;\n this.finish();\n return this;\n },\n\n finishImportSpecifier: function (local, imported) {\n this.type = Syntax.ImportSpecifier;\n this.local = local || imported;\n this.imported = imported;\n this.finish();\n return this;\n },\n\n finishImportDeclaration: function (specifiers, src) {\n this.type = Syntax.ImportDeclaration;\n this.specifiers = specifiers;\n this.source = src;\n this.finish();\n return this;\n },\n\n finishYieldExpression: function (argument, delegate) {\n this.type = Syntax.YieldExpression;\n this.argument = argument;\n this.delegate = delegate;\n this.finish();\n return this;\n }\n };\n\n\n function recordError(error) {\n var e, existing;\n\n for (e = 0; e < extra.errors.length; e++) {\n existing = extra.errors[e];\n // Prevent duplicated error.\n /* istanbul ignore next */\n if (existing.index === error.index && existing.message === error.message) {\n return;\n }\n }\n\n extra.errors.push(error);\n }\n\n function constructError(msg, column) {\n var error = new Error(msg);\n try {\n throw error;\n } catch (base) {\n /* istanbul ignore else */\n if (Object.create && Object.defineProperty) {\n error = Object.create(base);\n Object.defineProperty(error, 'column', { value: column });\n }\n } finally {\n return error;\n }\n }\n\n function createError(line, pos, description) {\n var msg, column, error;\n\n msg = 'Line ' + line + ': ' + description;\n column = pos - (scanning ? lineStart : lastLineStart) + 1;\n error = constructError(msg, column);\n error.lineNumber = line;\n error.description = description;\n error.index = pos;\n return error;\n }\n\n // Throw an exception\n\n function throwError(messageFormat) {\n var args, msg;\n\n args = Array.prototype.slice.call(arguments, 1);\n msg = messageFormat.replace(/%(\\d)/g,\n function (whole, idx) {\n assert(idx < args.length, 'Message reference must be in range');\n return args[idx];\n }\n );\n\n throw createError(lastLineNumber, lastIndex, msg);\n }\n\n function tolerateError(messageFormat) {\n var args, msg, error;\n\n args = Array.prototype.slice.call(arguments, 1);\n /* istanbul ignore next */\n msg = messageFormat.replace(/%(\\d)/g,\n function (whole, idx) {\n assert(idx < args.length, 'Message reference must be in range');\n return args[idx];\n }\n );\n\n error = createError(lineNumber, lastIndex, msg);\n if (extra.errors) {\n recordError(error);\n } else {\n throw error;\n }\n }\n\n // Throw an exception because of the token.\n\n function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }\n\n function throwUnexpectedToken(token, message) {\n throw unexpectedTokenError(token, message);\n }\n\n function tolerateUnexpectedToken(token, message) {\n var error = unexpectedTokenError(token, message);\n if (extra.errors) {\n recordError(error);\n } else {\n throw error;\n }\n }\n\n // Expect the next token to match the specified punctuator.\n // If not, an exception will be thrown.\n\n function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }\n\n /**\n * @name expectCommaSeparator\n * @description Quietly expect a comma when in tolerant mode, otherwise delegates\n * to expect(value)\n * @since 2.0\n */\n function expectCommaSeparator() {\n var token;\n\n if (extra.errors) {\n token = lookahead;\n if (token.type === Token.Punctuator && token.value === ',') {\n lex();\n } else if (token.type === Token.Punctuator && token.value === ';') {\n lex();\n tolerateUnexpectedToken(token);\n } else {\n tolerateUnexpectedToken(token, Messages.UnexpectedToken);\n }\n } else {\n expect(',');\n }\n }\n\n // Expect the next token to match the specified keyword.\n // If not, an exception will be thrown.\n\n function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }\n\n // Return true if the next token matches the specified punctuator.\n\n function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }\n\n // Return true if the next token matches the specified keyword\n\n function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }\n\n // Return true if the next token matches the specified contextual keyword\n // (where an identifier is sometimes a keyword depending on the context)\n\n function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }\n\n // Return true if the next token is an assignment operator\n\n function matchAssign() {\n var op;\n\n if (lookahead.type !== Token.Punctuator) {\n return false;\n }\n op = lookahead.value;\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }\n\n function consumeSemicolon() {\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(startIndex) === 0x3B || match(';')) {\n lex();\n return;\n }\n\n if (hasLineTerminator) {\n return;\n }\n\n // FIXME(ikarienator): this is seemingly an issue in the previous location info convention.\n lastIndex = startIndex;\n lastLineNumber = startLineNumber;\n lastLineStart = startLineStart;\n\n if (lookahead.type !== Token.EOF && !match('}')) {\n throwUnexpectedToken(lookahead);\n }\n }\n\n // Cover grammar support.\n //\n // When an assignment expression position starts with an left parenthesis, the determination of the type\n // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)\n // or the first comma. This situation also defers the determination of all the expressions nested in the pair.\n //\n // There are three productions that can be parsed in a parentheses pair that needs to be determined\n // after the outermost pair is closed. They are:\n //\n // 1. AssignmentExpression\n // 2. BindingElements\n // 3. AssignmentTargets\n //\n // In order to avoid exponential backtracking, we use two flags to denote if the production can be\n // binding element or assignment target.\n //\n // The three productions have the relationship:\n //\n // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression\n //\n // with a single exception that CoverInitializedName when used directly in an Expression, generates\n // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the\n // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.\n //\n // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not\n // effect the current flags. This means the production the parser parses is only used as an expression. Therefore\n // the CoverInitializedName check is conducted.\n //\n // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates\n // the flags outside of the parser. This means the production the parser parses is used as a part of a potential\n // pattern. The CoverInitializedName check is deferred.\n function isolateCoverGrammar(parser) {\n var oldIsBindingElement = isBindingElement,\n oldIsAssignmentTarget = isAssignmentTarget,\n oldFirstCoverInitializedNameError = firstCoverInitializedNameError,\n result;\n isBindingElement = true;\n isAssignmentTarget = true;\n firstCoverInitializedNameError = null;\n result = parser();\n if (firstCoverInitializedNameError !== null) {\n throwUnexpectedToken(firstCoverInitializedNameError);\n }\n isBindingElement = oldIsBindingElement;\n isAssignmentTarget = oldIsAssignmentTarget;\n firstCoverInitializedNameError = oldFirstCoverInitializedNameError;\n return result;\n }\n\n function inheritCoverGrammar(parser) {\n var oldIsBindingElement = isBindingElement,\n oldIsAssignmentTarget = isAssignmentTarget,\n oldFirstCoverInitializedNameError = firstCoverInitializedNameError,\n result;\n isBindingElement = true;\n isAssignmentTarget = true;\n firstCoverInitializedNameError = null;\n result = parser();\n isBindingElement = isBindingElement && oldIsBindingElement;\n isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget;\n firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError;\n return result;\n }\n\n // ECMA-262 13.3.3 Destructuring Binding Patterns\n\n function parseArrayPattern(params, kind) {\n var node = new Node(), elements = [], rest, restNode;\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n if (match('...')) {\n restNode = new Node();\n lex();\n params.push(lookahead);\n rest = parseVariableIdentifier(kind);\n elements.push(restNode.finishRestElement(rest));\n break;\n } else {\n elements.push(parsePatternWithDefault(params, kind));\n }\n if (!match(']')) {\n expect(',');\n }\n }\n\n }\n\n expect(']');\n\n return node.finishArrayPattern(elements);\n }\n\n function parsePropertyPattern(params, kind) {\n var node = new Node(), key, keyToken, computed = match('['), init;\n if (lookahead.type === Token.Identifier) {\n keyToken = lookahead;\n key = parseVariableIdentifier();\n if (match('=')) {\n params.push(keyToken);\n lex();\n init = parseAssignmentExpression();\n\n return node.finishProperty(\n 'init', key, false,\n new WrappingNode(keyToken).finishAssignmentPattern(key, init), false, false);\n } else if (!match(':')) {\n params.push(keyToken);\n return node.finishProperty('init', key, false, key, false, true);\n }\n } else {\n key = parseObjectPropertyKey();\n }\n expect(':');\n init = parsePatternWithDefault(params, kind);\n return node.finishProperty('init', key, computed, init, false, false);\n }\n\n function parseObjectPattern(params, kind) {\n var node = new Node(), properties = [];\n\n expect('{');\n\n while (!match('}')) {\n properties.push(parsePropertyPattern(params, kind));\n if (!match('}')) {\n expect(',');\n }\n }\n\n lex();\n\n return node.finishObjectPattern(properties);\n }\n\n function parsePattern(params, kind) {\n if (match('[')) {\n return parseArrayPattern(params, kind);\n } else if (match('{')) {\n return parseObjectPattern(params, kind);\n } else if (matchKeyword('let')) {\n if (kind === 'const' || kind === 'let') {\n tolerateUnexpectedToken(lookahead, Messages.UnexpectedToken);\n }\n }\n\n params.push(lookahead);\n return parseVariableIdentifier(kind);\n }\n\n function parsePatternWithDefault(params, kind) {\n var startToken = lookahead, pattern, previousAllowYield, right;\n pattern = parsePattern(params, kind);\n if (match('=')) {\n lex();\n previousAllowYield = state.allowYield;\n state.allowYield = true;\n right = isolateCoverGrammar(parseAssignmentExpression);\n state.allowYield = previousAllowYield;\n pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right);\n }\n return pattern;\n }\n\n // ECMA-262 12.2.5 Array Initializer\n\n function parseArrayInitializer() {\n var elements = [], node = new Node(), restSpread;\n\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else if (match('...')) {\n restSpread = new Node();\n lex();\n restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));\n\n if (!match(']')) {\n isAssignmentTarget = isBindingElement = false;\n expect(',');\n }\n elements.push(restSpread);\n } else {\n elements.push(inheritCoverGrammar(parseAssignmentExpression));\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return node.finishArrayExpression(elements);\n }\n\n // ECMA-262 12.2.6 Object Initializer\n\n function parsePropertyFunction(node, paramInfo, isGenerator) {\n var previousStrict, body;\n\n isAssignmentTarget = isBindingElement = false;\n\n previousStrict = strict;\n body = isolateCoverGrammar(parseFunctionSourceElements);\n\n if (strict && paramInfo.firstRestricted) {\n tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message);\n }\n if (strict && paramInfo.stricted) {\n tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message);\n }\n\n strict = previousStrict;\n return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body, isGenerator);\n }\n\n function parsePropertyMethodFunction() {\n var params, method, node = new Node(),\n previousAllowYield = state.allowYield;\n\n state.allowYield = false;\n params = parseParams();\n state.allowYield = previousAllowYield;\n\n state.allowYield = false;\n method = parsePropertyFunction(node, params, false);\n state.allowYield = previousAllowYield;\n\n return method;\n }\n\n function parseObjectPropertyKey() {\n var token, node = new Node(), expr;\n\n token = lex();\n\n // Note: This function is called only from parseObjectProperty(), where\n // EOF and Punctuator tokens are already filtered out.\n\n switch (token.type) {\n case Token.StringLiteral:\n case Token.NumericLiteral:\n if (strict && token.octal) {\n tolerateUnexpectedToken(token, Messages.StrictOctalLiteral);\n }\n return node.finishLiteral(token);\n case Token.Identifier:\n case Token.BooleanLiteral:\n case Token.NullLiteral:\n case Token.Keyword:\n return node.finishIdentifier(token.value);\n case Token.Punctuator:\n if (token.value === '[') {\n expr = isolateCoverGrammar(parseAssignmentExpression);\n expect(']');\n return expr;\n }\n break;\n }\n throwUnexpectedToken(token);\n }\n\n function lookaheadPropertyName() {\n switch (lookahead.type) {\n case Token.Identifier:\n case Token.StringLiteral:\n case Token.BooleanLiteral:\n case Token.NullLiteral:\n case Token.NumericLiteral:\n case Token.Keyword:\n return true;\n case Token.Punctuator:\n return lookahead.value === '[';\n }\n return false;\n }\n\n // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals,\n // it might be called at a position where there is in fact a short hand identifier pattern or a data property.\n // This can only be determined after we consumed up to the left parentheses.\n //\n // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller\n // is responsible to visit other options.\n function tryParseMethodDefinition(token, key, computed, node) {\n var value, options, methodNode, params,\n previousAllowYield = state.allowYield;\n\n if (token.type === Token.Identifier) {\n // check for `get` and `set`;\n\n if (token.value === 'get' && lookaheadPropertyName()) {\n computed = match('[');\n key = parseObjectPropertyKey();\n methodNode = new Node();\n expect('(');\n expect(')');\n\n state.allowYield = false;\n value = parsePropertyFunction(methodNode, {\n params: [],\n defaults: [],\n stricted: null,\n firstRestricted: null,\n message: null\n }, false);\n state.allowYield = previousAllowYield;\n\n return node.finishProperty('get', key, computed, value, false, false);\n } else if (token.value === 'set' && lookaheadPropertyName()) {\n computed = match('[');\n key = parseObjectPropertyKey();\n methodNode = new Node();\n expect('(');\n\n options = {\n params: [],\n defaultCount: 0,\n defaults: [],\n firstRestricted: null,\n paramSet: {}\n };\n if (match(')')) {\n tolerateUnexpectedToken(lookahead);\n } else {\n state.allowYield = false;\n parseParam(options);\n state.allowYield = previousAllowYield;\n if (options.defaultCount === 0) {\n options.defaults = [];\n }\n }\n expect(')');\n\n state.allowYield = false;\n value = parsePropertyFunction(methodNode, options, false);\n state.allowYield = previousAllowYield;\n\n return node.finishProperty('set', key, computed, value, false, false);\n }\n } else if (token.type === Token.Punctuator && token.value === '*' && lookaheadPropertyName()) {\n computed = match('[');\n key = parseObjectPropertyKey();\n methodNode = new Node();\n\n state.allowYield = true;\n params = parseParams();\n state.allowYield = previousAllowYield;\n\n state.allowYield = false;\n value = parsePropertyFunction(methodNode, params, true);\n state.allowYield = previousAllowYield;\n\n return node.finishProperty('init', key, computed, value, true, false);\n }\n\n if (key && match('(')) {\n value = parsePropertyMethodFunction();\n return node.finishProperty('init', key, computed, value, true, false);\n }\n\n // Not a MethodDefinition.\n return null;\n }\n\n function parseObjectProperty(hasProto) {\n var token = lookahead, node = new Node(), computed, key, maybeMethod, proto, value;\n\n computed = match('[');\n if (match('*')) {\n lex();\n } else {\n key = parseObjectPropertyKey();\n }\n maybeMethod = tryParseMethodDefinition(token, key, computed, node);\n if (maybeMethod) {\n return maybeMethod;\n }\n\n if (!key) {\n throwUnexpectedToken(lookahead);\n }\n\n // Check for duplicated __proto__\n if (!computed) {\n proto = (key.type === Syntax.Identifier && key.name === '__proto__') ||\n (key.type === Syntax.Literal && key.value === '__proto__');\n if (hasProto.value && proto) {\n tolerateError(Messages.DuplicateProtoProperty);\n }\n hasProto.value |= proto;\n }\n\n if (match(':')) {\n lex();\n value = inheritCoverGrammar(parseAssignmentExpression);\n return node.finishProperty('init', key, computed, value, false, false);\n }\n\n if (token.type === Token.Identifier) {\n if (match('=')) {\n firstCoverInitializedNameError = lookahead;\n lex();\n value = isolateCoverGrammar(parseAssignmentExpression);\n return node.finishProperty('init', key, computed,\n new WrappingNode(token).finishAssignmentPattern(key, value), false, true);\n }\n return node.finishProperty('init', key, computed, key, false, true);\n }\n\n throwUnexpectedToken(lookahead);\n }\n\n function parseObjectInitializer() {\n var properties = [], hasProto = {value: false}, node = new Node();\n\n expect('{');\n\n while (!match('}')) {\n properties.push(parseObjectProperty(hasProto));\n\n if (!match('}')) {\n expectCommaSeparator();\n }\n }\n\n expect('}');\n\n return node.finishObjectExpression(properties);\n }\n\n function reinterpretExpressionAsPattern(expr) {\n var i;\n switch (expr.type) {\n case Syntax.Identifier:\n case Syntax.MemberExpression:\n case Syntax.RestElement:\n case Syntax.AssignmentPattern:\n break;\n case Syntax.SpreadElement:\n expr.type = Syntax.RestElement;\n reinterpretExpressionAsPattern(expr.argument);\n break;\n case Syntax.ArrayExpression:\n expr.type = Syntax.ArrayPattern;\n for (i = 0; i < expr.elements.length; i++) {\n if (expr.elements[i] !== null) {\n reinterpretExpressionAsPattern(expr.elements[i]);\n }\n }\n break;\n case Syntax.ObjectExpression:\n expr.type = Syntax.ObjectPattern;\n for (i = 0; i < expr.properties.length; i++) {\n reinterpretExpressionAsPattern(expr.properties[i].value);\n }\n break;\n case Syntax.AssignmentExpression:\n expr.type = Syntax.AssignmentPattern;\n reinterpretExpressionAsPattern(expr.left);\n break;\n default:\n // Allow other node type for tolerant parsing.\n break;\n }\n }\n\n // ECMA-262 12.2.9 Template Literals\n\n function parseTemplateElement(option) {\n var node, token;\n\n if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {\n throwUnexpectedToken();\n }\n\n node = new Node();\n token = lex();\n\n return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);\n }\n\n function parseTemplateLiteral() {\n var quasi, quasis, expressions, node = new Node();\n\n quasi = parseTemplateElement({ head: true });\n quasis = [quasi];\n expressions = [];\n\n while (!quasi.tail) {\n expressions.push(parseExpression());\n quasi = parseTemplateElement({ head: false });\n quasis.push(quasi);\n }\n\n return node.finishTemplateLiteral(quasis, expressions);\n }\n\n // ECMA-262 12.2.10 The Grouping Operator\n\n function parseGroupExpression() {\n var expr, expressions, startToken, i, params = [];\n\n expect('(');\n\n if (match(')')) {\n lex();\n if (!match('=>')) {\n expect('=>');\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [],\n rawParams: []\n };\n }\n\n startToken = lookahead;\n if (match('...')) {\n expr = parseRestElement(params);\n expect(')');\n if (!match('=>')) {\n expect('=>');\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [expr]\n };\n }\n\n isBindingElement = true;\n expr = inheritCoverGrammar(parseAssignmentExpression);\n\n if (match(',')) {\n isAssignmentTarget = false;\n expressions = [expr];\n\n while (startIndex < length) {\n if (!match(',')) {\n break;\n }\n lex();\n\n if (match('...')) {\n if (!isBindingElement) {\n throwUnexpectedToken(lookahead);\n }\n expressions.push(parseRestElement(params));\n expect(')');\n if (!match('=>')) {\n expect('=>');\n }\n isBindingElement = false;\n for (i = 0; i < expressions.length; i++) {\n reinterpretExpressionAsPattern(expressions[i]);\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: expressions\n };\n }\n\n expressions.push(inheritCoverGrammar(parseAssignmentExpression));\n }\n\n expr = new WrappingNode(startToken).finishSequenceExpression(expressions);\n }\n\n\n expect(')');\n\n if (match('=>')) {\n if (expr.type === Syntax.Identifier && expr.name === 'yield') {\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [expr]\n };\n }\n\n if (!isBindingElement) {\n throwUnexpectedToken(lookahead);\n }\n\n if (expr.type === Syntax.SequenceExpression) {\n for (i = 0; i < expr.expressions.length; i++) {\n reinterpretExpressionAsPattern(expr.expressions[i]);\n }\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n expr = {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]\n };\n }\n isBindingElement = false;\n return expr;\n }\n\n\n // ECMA-262 12.2 Primary Expressions\n\n function parsePrimaryExpression() {\n var type, token, expr, node;\n\n if (match('(')) {\n isBindingElement = false;\n return inheritCoverGrammar(parseGroupExpression);\n }\n\n if (match('[')) {\n return inheritCoverGrammar(parseArrayInitializer);\n }\n\n if (match('{')) {\n return inheritCoverGrammar(parseObjectInitializer);\n }\n\n type = lookahead.type;\n node = new Node();\n\n if (type === Token.Identifier) {\n if (state.sourceType === 'module' && lookahead.value === 'await') {\n tolerateUnexpectedToken(lookahead);\n }\n expr = node.finishIdentifier(lex().value);\n } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n isAssignmentTarget = isBindingElement = false;\n if (strict && lookahead.octal) {\n tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral);\n }\n expr = node.finishLiteral(lex());\n } else if (type === Token.Keyword) {\n if (!strict && state.allowYield && matchKeyword('yield')) {\n return parseNonComputedProperty();\n }\n if (!strict && matchKeyword('let')) {\n return node.finishIdentifier(lex().value);\n }\n isAssignmentTarget = isBindingElement = false;\n if (matchKeyword('function')) {\n return parseFunctionExpression();\n }\n if (matchKeyword('this')) {\n lex();\n return node.finishThisExpression();\n }\n if (matchKeyword('class')) {\n return parseClassExpression();\n }\n throwUnexpectedToken(lex());\n } else if (type === Token.BooleanLiteral) {\n isAssignmentTarget = isBindingElement = false;\n token = lex();\n token.value = (token.value === 'true');\n expr = node.finishLiteral(token);\n } else if (type === Token.NullLiteral) {\n isAssignmentTarget = isBindingElement = false;\n token = lex();\n token.value = null;\n expr = node.finishLiteral(token);\n } else if (match('/') || match('/=')) {\n isAssignmentTarget = isBindingElement = false;\n index = startIndex;\n\n if (typeof extra.tokens !== 'undefined') {\n token = collectRegex();\n } else {\n token = scanRegExp();\n }\n lex();\n expr = node.finishLiteral(token);\n } else if (type === Token.Template) {\n expr = parseTemplateLiteral();\n } else {\n throwUnexpectedToken(lex());\n }\n\n return expr;\n }\n\n // ECMA-262 12.3 Left-Hand-Side Expressions\n\n function parseArguments() {\n var args = [], expr;\n\n expect('(');\n\n if (!match(')')) {\n while (startIndex < length) {\n if (match('...')) {\n expr = new Node();\n lex();\n expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression));\n } else {\n expr = isolateCoverGrammar(parseAssignmentExpression);\n }\n args.push(expr);\n if (match(')')) {\n break;\n }\n expectCommaSeparator();\n }\n }\n\n expect(')');\n\n return args;\n }\n\n function parseNonComputedProperty() {\n var token, node = new Node();\n\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpectedToken(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n }\n\n function parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = isolateCoverGrammar(parseExpression);\n\n expect(']');\n\n return expr;\n }\n\n // ECMA-262 12.3.3 The new Operator\n\n function parseNewExpression() {\n var callee, args, node = new Node();\n\n expectKeyword('new');\n\n if (match('.')) {\n lex();\n if (lookahead.type === Token.Identifier && lookahead.value === 'target') {\n if (state.inFunctionBody) {\n lex();\n return node.finishMetaProperty('new', 'target');\n }\n }\n throwUnexpectedToken(lookahead);\n }\n\n callee = isolateCoverGrammar(parseLeftHandSideExpression);\n args = match('(') ? parseArguments() : [];\n\n isAssignmentTarget = isBindingElement = false;\n\n return node.finishNewExpression(callee, args);\n }\n\n // ECMA-262 12.3.4 Function Calls\n\n function parseLeftHandSideExpressionAllowCall() {\n var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('(') && !match('.') && !match('[')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n isBindingElement = false;\n isAssignmentTarget = false;\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }\n\n // ECMA-262 12.3 Left-Hand-Side Expressions\n\n function parseLeftHandSideExpression() {\n var quasi, expr, property, startToken;\n assert(state.allowIn, 'callee of new expression always allow in keyword.');\n\n startToken = lookahead;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('[') && !match('.')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n return expr;\n }\n\n // ECMA-262 12.4 Postfix Expressions\n\n function parsePostfixExpression() {\n var expr, token, startToken = lookahead;\n\n expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);\n\n if (!hasLineTerminator && lookahead.type === Token.Punctuator) {\n if (match('++') || match('--')) {\n // ECMA-262 11.3.1, 11.3.2\n if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {\n tolerateError(Messages.StrictLHSPostfix);\n }\n\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n\n isAssignmentTarget = isBindingElement = false;\n\n token = lex();\n expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr);\n }\n }\n\n return expr;\n }\n\n // ECMA-262 12.5 Unary Operators\n\n function parseUnaryExpression() {\n var token, expr, startToken;\n\n if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n startToken = lookahead;\n token = lex();\n expr = inheritCoverGrammar(parseUnaryExpression);\n // ECMA-262 11.4.4, 11.4.5\n if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {\n tolerateError(Messages.StrictLHSPrefix);\n }\n\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);\n isAssignmentTarget = isBindingElement = false;\n } else if (match('+') || match('-') || match('~') || match('!')) {\n startToken = lookahead;\n token = lex();\n expr = inheritCoverGrammar(parseUnaryExpression);\n expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);\n isAssignmentTarget = isBindingElement = false;\n } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {\n startToken = lookahead;\n token = lex();\n expr = inheritCoverGrammar(parseUnaryExpression);\n expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);\n if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {\n tolerateError(Messages.StrictDelete);\n }\n isAssignmentTarget = isBindingElement = false;\n } else {\n expr = parsePostfixExpression();\n }\n\n return expr;\n }\n\n function binaryPrecedence(token, allowIn) {\n var prec = 0;\n\n if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\n return 0;\n }\n\n switch (token.value) {\n case '||':\n prec = 1;\n break;\n\n case '&&':\n prec = 2;\n break;\n\n case '|':\n prec = 3;\n break;\n\n case '^':\n prec = 4;\n break;\n\n case '&':\n prec = 5;\n break;\n\n case '==':\n case '!=':\n case '===':\n case '!==':\n prec = 6;\n break;\n\n case '<':\n case '>':\n case '<=':\n case '>=':\n case 'instanceof':\n prec = 7;\n break;\n\n case 'in':\n prec = allowIn ? 7 : 0;\n break;\n\n case '<<':\n case '>>':\n case '>>>':\n prec = 8;\n break;\n\n case '+':\n case '-':\n prec = 9;\n break;\n\n case '*':\n case '/':\n case '%':\n prec = 11;\n break;\n\n default:\n break;\n }\n\n return prec;\n }\n\n // ECMA-262 12.6 Multiplicative Operators\n // ECMA-262 12.7 Additive Operators\n // ECMA-262 12.8 Bitwise Shift Operators\n // ECMA-262 12.9 Relational Operators\n // ECMA-262 12.10 Equality Operators\n // ECMA-262 12.11 Binary Bitwise Operators\n // ECMA-262 12.12 Binary Logical Operators\n\n function parseBinaryExpression() {\n var marker, markers, expr, token, prec, stack, right, operator, left, i;\n\n marker = lookahead;\n left = inheritCoverGrammar(parseUnaryExpression);\n\n token = lookahead;\n prec = binaryPrecedence(token, state.allowIn);\n if (prec === 0) {\n return left;\n }\n isAssignmentTarget = isBindingElement = false;\n token.prec = prec;\n lex();\n\n markers = [marker, lookahead];\n right = isolateCoverGrammar(parseUnaryExpression);\n\n stack = [left, token, right];\n\n while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) {\n\n // Reduce: make a binary expression from the three topmost entries.\n while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {\n right = stack.pop();\n operator = stack.pop().value;\n left = stack.pop();\n markers.pop();\n expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right);\n stack.push(expr);\n }\n\n // Shift.\n token = lex();\n token.prec = prec;\n stack.push(token);\n markers.push(lookahead);\n expr = isolateCoverGrammar(parseUnaryExpression);\n stack.push(expr);\n }\n\n // Final reduce to clean-up the stack.\n i = stack.length - 1;\n expr = stack[i];\n markers.pop();\n while (i > 1) {\n expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);\n i -= 2;\n }\n\n return expr;\n }\n\n\n // ECMA-262 12.13 Conditional Operator\n\n function parseConditionalExpression() {\n var expr, previousAllowIn, consequent, alternate, startToken;\n\n startToken = lookahead;\n\n expr = inheritCoverGrammar(parseBinaryExpression);\n if (match('?')) {\n lex();\n previousAllowIn = state.allowIn;\n state.allowIn = true;\n consequent = isolateCoverGrammar(parseAssignmentExpression);\n state.allowIn = previousAllowIn;\n expect(':');\n alternate = isolateCoverGrammar(parseAssignmentExpression);\n\n expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);\n isAssignmentTarget = isBindingElement = false;\n }\n\n return expr;\n }\n\n // ECMA-262 14.2 Arrow Function Definitions\n\n function parseConciseBody() {\n if (match('{')) {\n return parseFunctionSourceElements();\n }\n return isolateCoverGrammar(parseAssignmentExpression);\n }\n\n function checkPatternParam(options, param) {\n var i;\n switch (param.type) {\n case Syntax.Identifier:\n validateParam(options, param, param.name);\n break;\n case Syntax.RestElement:\n checkPatternParam(options, param.argument);\n break;\n case Syntax.AssignmentPattern:\n checkPatternParam(options, param.left);\n break;\n case Syntax.ArrayPattern:\n for (i = 0; i < param.elements.length; i++) {\n if (param.elements[i] !== null) {\n checkPatternParam(options, param.elements[i]);\n }\n }\n break;\n case Syntax.YieldExpression:\n break;\n default:\n assert(param.type === Syntax.ObjectPattern, 'Invalid type');\n for (i = 0; i < param.properties.length; i++) {\n checkPatternParam(options, param.properties[i].value);\n }\n break;\n }\n }\n function reinterpretAsCoverFormalsList(expr) {\n var i, len, param, params, defaults, defaultCount, options, token;\n\n defaults = [];\n defaultCount = 0;\n params = [expr];\n\n switch (expr.type) {\n case Syntax.Identifier:\n break;\n case PlaceHolders.ArrowParameterPlaceHolder:\n params = expr.params;\n break;\n default:\n return null;\n }\n\n options = {\n paramSet: {}\n };\n\n for (i = 0, len = params.length; i < len; i += 1) {\n param = params[i];\n switch (param.type) {\n case Syntax.AssignmentPattern:\n params[i] = param.left;\n if (param.right.type === Syntax.YieldExpression) {\n if (param.right.argument) {\n throwUnexpectedToken(lookahead);\n }\n param.right.type = Syntax.Identifier;\n param.right.name = 'yield';\n delete param.right.argument;\n delete param.right.delegate;\n }\n defaults.push(param.right);\n ++defaultCount;\n checkPatternParam(options, param.left);\n break;\n default:\n checkPatternParam(options, param);\n params[i] = param;\n defaults.push(null);\n break;\n }\n }\n\n if (strict || !state.allowYield) {\n for (i = 0, len = params.length; i < len; i += 1) {\n param = params[i];\n if (param.type === Syntax.YieldExpression) {\n throwUnexpectedToken(lookahead);\n }\n }\n }\n\n if (options.message === Messages.StrictParamDupe) {\n token = strict ? options.stricted : options.firstRestricted;\n throwUnexpectedToken(token, options.message);\n }\n\n if (defaultCount === 0) {\n defaults = [];\n }\n\n return {\n params: params,\n defaults: defaults,\n stricted: options.stricted,\n firstRestricted: options.firstRestricted,\n message: options.message\n };\n }\n\n function parseArrowFunctionExpression(options, node) {\n var previousStrict, previousAllowYield, body;\n\n if (hasLineTerminator) {\n tolerateUnexpectedToken(lookahead);\n }\n expect('=>');\n\n previousStrict = strict;\n previousAllowYield = state.allowYield;\n state.allowYield = true;\n\n body = parseConciseBody();\n\n if (strict && options.firstRestricted) {\n throwUnexpectedToken(options.firstRestricted, options.message);\n }\n if (strict && options.stricted) {\n tolerateUnexpectedToken(options.stricted, options.message);\n }\n\n strict = previousStrict;\n state.allowYield = previousAllowYield;\n\n return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement);\n }\n\n // ECMA-262 14.4 Yield expression\n\n function parseYieldExpression() {\n var argument, expr, delegate, previousAllowYield;\n\n argument = null;\n expr = new Node();\n delegate = false;\n\n expectKeyword('yield');\n\n if (!hasLineTerminator) {\n previousAllowYield = state.allowYield;\n state.allowYield = false;\n delegate = match('*');\n if (delegate) {\n lex();\n argument = parseAssignmentExpression();\n } else {\n if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {\n argument = parseAssignmentExpression();\n }\n }\n state.allowYield = previousAllowYield;\n }\n\n return expr.finishYieldExpression(argument, delegate);\n }\n\n // ECMA-262 12.14 Assignment Operators\n\n function parseAssignmentExpression() {\n var token, expr, right, list, startToken;\n\n startToken = lookahead;\n token = lookahead;\n\n if (!state.allowYield && matchKeyword('yield')) {\n return parseYieldExpression();\n }\n\n expr = parseConditionalExpression();\n\n if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {\n isAssignmentTarget = isBindingElement = false;\n list = reinterpretAsCoverFormalsList(expr);\n\n if (list) {\n firstCoverInitializedNameError = null;\n return parseArrowFunctionExpression(list, new WrappingNode(startToken));\n }\n\n return expr;\n }\n\n if (matchAssign()) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n\n // ECMA-262 12.1.1\n if (strict && expr.type === Syntax.Identifier) {\n if (isRestrictedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);\n }\n if (isStrictModeReservedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n }\n }\n\n if (!match('=')) {\n isAssignmentTarget = isBindingElement = false;\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n token = lex();\n right = isolateCoverGrammar(parseAssignmentExpression);\n expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);\n firstCoverInitializedNameError = null;\n }\n\n return expr;\n }\n\n // ECMA-262 12.15 Comma Operator\n\n function parseExpression() {\n var expr, startToken = lookahead, expressions;\n\n expr = isolateCoverGrammar(parseAssignmentExpression);\n\n if (match(',')) {\n expressions = [expr];\n\n while (startIndex < length) {\n if (!match(',')) {\n break;\n }\n lex();\n expressions.push(isolateCoverGrammar(parseAssignmentExpression));\n }\n\n expr = new WrappingNode(startToken).finishSequenceExpression(expressions);\n }\n\n return expr;\n }\n\n // ECMA-262 13.2 Block\n\n function parseStatementListItem() {\n if (lookahead.type === Token.Keyword) {\n switch (lookahead.value) {\n case 'export':\n if (state.sourceType !== 'module') {\n tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);\n }\n return parseExportDeclaration();\n case 'import':\n if (state.sourceType !== 'module') {\n tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration);\n }\n return parseImportDeclaration();\n case 'const':\n return parseLexicalDeclaration({inFor: false});\n case 'function':\n return parseFunctionDeclaration(new Node());\n case 'class':\n return parseClassDeclaration();\n }\n }\n\n if (matchKeyword('let') && isLexicalDeclaration()) {\n return parseLexicalDeclaration({inFor: false});\n }\n\n return parseStatement();\n }\n\n function parseStatementList() {\n var list = [];\n while (startIndex < length) {\n if (match('}')) {\n break;\n }\n list.push(parseStatementListItem());\n }\n\n return list;\n }\n\n function parseBlock() {\n var block, node = new Node();\n\n expect('{');\n\n block = parseStatementList();\n\n expect('}');\n\n return node.finishBlockStatement(block);\n }\n\n // ECMA-262 13.3.2 Variable Statement\n\n function parseVariableIdentifier(kind) {\n var token, node = new Node();\n\n token = lex();\n\n if (token.type === Token.Keyword && token.value === 'yield') {\n if (strict) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } if (!state.allowYield) {\n throwUnexpectedToken(token);\n }\n } else if (token.type !== Token.Identifier) {\n if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } else {\n if (strict || token.value !== 'let' || kind !== 'var') {\n throwUnexpectedToken(token);\n }\n }\n } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {\n tolerateUnexpectedToken(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseVariableDeclaration(options) {\n var init = null, id, node = new Node(), params = [];\n\n id = parsePattern(params, 'var');\n\n // ECMA-262 12.2.1\n if (strict && isRestrictedWord(id.name)) {\n tolerateError(Messages.StrictVarName);\n }\n\n if (match('=')) {\n lex();\n init = isolateCoverGrammar(parseAssignmentExpression);\n } else if (id.type !== Syntax.Identifier && !options.inFor) {\n expect('=');\n }\n\n return node.finishVariableDeclarator(id, init);\n }\n\n function parseVariableDeclarationList(options) {\n var opt, list;\n\n opt = { inFor: options.inFor };\n list = [parseVariableDeclaration(opt)];\n\n while (match(',')) {\n lex();\n list.push(parseVariableDeclaration(opt));\n }\n\n return list;\n }\n\n function parseVariableStatement(node) {\n var declarations;\n\n expectKeyword('var');\n\n declarations = parseVariableDeclarationList({ inFor: false });\n\n consumeSemicolon();\n\n return node.finishVariableDeclaration(declarations);\n }\n\n // ECMA-262 13.3.1 Let and Const Declarations\n\n function parseLexicalBinding(kind, options) {\n var init = null, id, node = new Node(), params = [];\n\n id = parsePattern(params, kind);\n\n // ECMA-262 12.2.1\n if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {\n tolerateError(Messages.StrictVarName);\n }\n\n if (kind === 'const') {\n if (!matchKeyword('in') && !matchContextualKeyword('of')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n\n return node.finishVariableDeclarator(id, init);\n }\n\n function parseBindingList(kind, options) {\n var list = [parseLexicalBinding(kind, options)];\n\n while (match(',')) {\n lex();\n list.push(parseLexicalBinding(kind, options));\n }\n\n return list;\n }\n\n\n function tokenizerState() {\n return {\n index: index,\n lineNumber: lineNumber,\n lineStart: lineStart,\n hasLineTerminator: hasLineTerminator,\n lastIndex: lastIndex,\n lastLineNumber: lastLineNumber,\n lastLineStart: lastLineStart,\n startIndex: startIndex,\n startLineNumber: startLineNumber,\n startLineStart: startLineStart,\n lookahead: lookahead,\n tokenCount: extra.tokens ? extra.tokens.length : 0\n };\n }\n\n function resetTokenizerState(ts) {\n index = ts.index;\n lineNumber = ts.lineNumber;\n lineStart = ts.lineStart;\n hasLineTerminator = ts.hasLineTerminator;\n lastIndex = ts.lastIndex;\n lastLineNumber = ts.lastLineNumber;\n lastLineStart = ts.lastLineStart;\n startIndex = ts.startIndex;\n startLineNumber = ts.startLineNumber;\n startLineStart = ts.startLineStart;\n lookahead = ts.lookahead;\n if (extra.tokens) {\n extra.tokens.splice(ts.tokenCount, extra.tokens.length);\n }\n }\n\n function isLexicalDeclaration() {\n var lexical, ts;\n\n ts = tokenizerState();\n\n lex();\n lexical = (lookahead.type === Token.Identifier) || match('[') || match('{') ||\n matchKeyword('let') || matchKeyword('yield');\n\n resetTokenizerState(ts);\n\n return lexical;\n }\n\n function parseLexicalDeclaration(options) {\n var kind, declarations, node = new Node();\n\n kind = lex().value;\n assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');\n\n declarations = parseBindingList(kind, options);\n\n consumeSemicolon();\n\n return node.finishLexicalDeclaration(declarations, kind);\n }\n\n function parseRestElement(params) {\n var param, node = new Node();\n\n lex();\n\n if (match('{')) {\n throwError(Messages.ObjectPatternAsRestParameter);\n }\n\n params.push(lookahead);\n\n param = parseVariableIdentifier();\n\n if (match('=')) {\n throwError(Messages.DefaultRestParameter);\n }\n\n if (!match(')')) {\n throwError(Messages.ParameterAfterRestParameter);\n }\n\n return node.finishRestElement(param);\n }\n\n // ECMA-262 13.4 Empty Statement\n\n function parseEmptyStatement(node) {\n expect(';');\n return node.finishEmptyStatement();\n }\n\n // ECMA-262 12.4 Expression Statement\n\n function parseExpressionStatement(node) {\n var expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // ECMA-262 13.6 If statement\n\n function parseIfStatement(node) {\n var test, consequent, alternate;\n\n expectKeyword('if');\n\n expect('(');\n\n test = parseExpression();\n\n expect(')');\n\n consequent = parseStatement();\n\n if (matchKeyword('else')) {\n lex();\n alternate = parseStatement();\n } else {\n alternate = null;\n }\n\n return node.finishIfStatement(test, consequent, alternate);\n }\n\n // ECMA-262 13.7 Iteration Statements\n\n function parseDoWhileStatement(node) {\n var body, test, oldInIteration;\n\n expectKeyword('do');\n\n oldInIteration = state.inIteration;\n state.inIteration = true;\n\n body = parseStatement();\n\n state.inIteration = oldInIteration;\n\n expectKeyword('while');\n\n expect('(');\n\n test = parseExpression();\n\n expect(')');\n\n if (match(';')) {\n lex();\n }\n\n return node.finishDoWhileStatement(body, test);\n }\n\n function parseWhileStatement(node) {\n var test, body, oldInIteration;\n\n expectKeyword('while');\n\n expect('(');\n\n test = parseExpression();\n\n expect(')');\n\n oldInIteration = state.inIteration;\n state.inIteration = true;\n\n body = parseStatement();\n\n state.inIteration = oldInIteration;\n\n return node.finishWhileStatement(test, body);\n }\n\n function parseForStatement(node) {\n var init, forIn, initSeq, initStartToken, test, update, left, right, kind, declarations,\n body, oldInIteration, previousAllowIn = state.allowIn;\n\n init = test = update = null;\n forIn = true;\n\n expectKeyword('for');\n\n expect('(');\n\n if (match(';')) {\n lex();\n } else {\n if (matchKeyword('var')) {\n init = new Node();\n lex();\n\n state.allowIn = false;\n declarations = parseVariableDeclarationList({ inFor: true });\n state.allowIn = previousAllowIn;\n\n if (declarations.length === 1 && matchKeyword('in')) {\n init = init.finishVariableDeclaration(declarations);\n lex();\n left = init;\n right = parseExpression();\n init = null;\n } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) {\n init = init.finishVariableDeclaration(declarations);\n lex();\n left = init;\n right = parseAssignmentExpression();\n init = null;\n forIn = false;\n } else {\n init = init.finishVariableDeclaration(declarations);\n expect(';');\n }\n } else if (matchKeyword('const') || matchKeyword('let')) {\n init = new Node();\n kind = lex().value;\n\n if (!strict && lookahead.value === 'in') {\n init = init.finishIdentifier(kind);\n lex();\n left = init;\n right = parseExpression();\n init = null;\n } else {\n state.allowIn = false;\n declarations = parseBindingList(kind, {inFor: true});\n state.allowIn = previousAllowIn;\n\n if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) {\n init = init.finishLexicalDeclaration(declarations, kind);\n lex();\n left = init;\n right = parseExpression();\n init = null;\n } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) {\n init = init.finishLexicalDeclaration(declarations, kind);\n lex();\n left = init;\n right = parseAssignmentExpression();\n init = null;\n forIn = false;\n } else {\n consumeSemicolon();\n init = init.finishLexicalDeclaration(declarations, kind);\n }\n }\n } else {\n initStartToken = lookahead;\n state.allowIn = false;\n init = inheritCoverGrammar(parseAssignmentExpression);\n state.allowIn = previousAllowIn;\n\n if (matchKeyword('in')) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInForIn);\n }\n\n lex();\n reinterpretExpressionAsPattern(init);\n left = init;\n right = parseExpression();\n init = null;\n } else if (matchContextualKeyword('of')) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInForLoop);\n }\n\n lex();\n reinterpretExpressionAsPattern(init);\n left = init;\n right = parseAssignmentExpression();\n init = null;\n forIn = false;\n } else {\n if (match(',')) {\n initSeq = [init];\n while (match(',')) {\n lex();\n initSeq.push(isolateCoverGrammar(parseAssignmentExpression));\n }\n init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq);\n }\n expect(';');\n }\n }\n }\n\n if (typeof left === 'undefined') {\n\n if (!match(';')) {\n test = parseExpression();\n }\n expect(';');\n\n if (!match(')')) {\n update = parseExpression();\n }\n }\n\n expect(')');\n\n oldInIteration = state.inIteration;\n state.inIteration = true;\n\n body = isolateCoverGrammar(parseStatement);\n\n state.inIteration = oldInIteration;\n\n return (typeof left === 'undefined') ?\n node.finishForStatement(init, test, update, body) :\n forIn ? node.finishForInStatement(left, right, body) :\n node.finishForOfStatement(left, right, body);\n }\n\n // ECMA-262 13.8 The continue statement\n\n function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }\n\n // ECMA-262 13.9 The break statement\n\n function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n } else if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }\n\n // ECMA-262 13.10 The return statement\n\n function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }\n\n // ECMA-262 13.11 The with statement\n\n function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }\n\n // ECMA-262 13.12 The switch statement\n\n function parseSwitchCase() {\n var test, consequent = [], statement, node = new Node();\n\n if (matchKeyword('default')) {\n lex();\n test = null;\n } else {\n expectKeyword('case');\n test = parseExpression();\n }\n expect(':');\n\n while (startIndex < length) {\n if (match('}') || matchKeyword('default') || matchKeyword('case')) {\n break;\n }\n statement = parseStatementListItem();\n consequent.push(statement);\n }\n\n return node.finishSwitchCase(test, consequent);\n }\n\n function parseSwitchStatement(node) {\n var discriminant, cases, clause, oldInSwitch, defaultFound;\n\n expectKeyword('switch');\n\n expect('(');\n\n discriminant = parseExpression();\n\n expect(')');\n\n expect('{');\n\n cases = [];\n\n if (match('}')) {\n lex();\n return node.finishSwitchStatement(discriminant, cases);\n }\n\n oldInSwitch = state.inSwitch;\n state.inSwitch = true;\n defaultFound = false;\n\n while (startIndex < length) {\n if (match('}')) {\n break;\n }\n clause = parseSwitchCase();\n if (clause.test === null) {\n if (defaultFound) {\n throwError(Messages.MultipleDefaultsInSwitch);\n }\n defaultFound = true;\n }\n cases.push(clause);\n }\n\n state.inSwitch = oldInSwitch;\n\n expect('}');\n\n return node.finishSwitchStatement(discriminant, cases);\n }\n\n // ECMA-262 13.14 The throw statement\n\n function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }\n\n // ECMA-262 13.15 The try statement\n\n function parseCatchClause() {\n var param, params = [], paramMap = {}, key, i, body, node = new Node();\n\n expectKeyword('catch');\n\n expect('(');\n if (match(')')) {\n throwUnexpectedToken(lookahead);\n }\n\n param = parsePattern(params);\n for (i = 0; i < params.length; i++) {\n key = '$' + params[i].value;\n if (Object.prototype.hasOwnProperty.call(paramMap, key)) {\n tolerateError(Messages.DuplicateBinding, params[i].value);\n }\n paramMap[key] = true;\n }\n\n // ECMA-262 12.14.1\n if (strict && isRestrictedWord(param.name)) {\n tolerateError(Messages.StrictCatchVariable);\n }\n\n expect(')');\n body = parseBlock();\n return node.finishCatchClause(param, body);\n }\n\n function parseTryStatement(node) {\n var block, handler = null, finalizer = null;\n\n expectKeyword('try');\n\n block = parseBlock();\n\n if (matchKeyword('catch')) {\n handler = parseCatchClause();\n }\n\n if (matchKeyword('finally')) {\n lex();\n finalizer = parseBlock();\n }\n\n if (!handler && !finalizer) {\n throwError(Messages.NoCatchOrFinally);\n }\n\n return node.finishTryStatement(block, handler, finalizer);\n }\n\n // ECMA-262 13.16 The debugger statement\n\n function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }\n\n // 13 Statements\n\n function parseStatement() {\n var type = lookahead.type,\n expr,\n labeledBody,\n key,\n node;\n\n if (type === Token.EOF) {\n throwUnexpectedToken(lookahead);\n }\n\n if (type === Token.Punctuator && lookahead.value === '{') {\n return parseBlock();\n }\n isAssignmentTarget = isBindingElement = true;\n node = new Node();\n\n if (type === Token.Punctuator) {\n switch (lookahead.value) {\n case ';':\n return parseEmptyStatement(node);\n case '(':\n return parseExpressionStatement(node);\n default:\n break;\n }\n } else if (type === Token.Keyword) {\n switch (lookahead.value) {\n case 'break':\n return parseBreakStatement(node);\n case 'continue':\n return parseContinueStatement(node);\n case 'debugger':\n return parseDebuggerStatement(node);\n case 'do':\n return parseDoWhileStatement(node);\n case 'for':\n return parseForStatement(node);\n case 'function':\n return parseFunctionDeclaration(node);\n case 'if':\n return parseIfStatement(node);\n case 'return':\n return parseReturnStatement(node);\n case 'switch':\n return parseSwitchStatement(node);\n case 'throw':\n return parseThrowStatement(node);\n case 'try':\n return parseTryStatement(node);\n case 'var':\n return parseVariableStatement(node);\n case 'while':\n return parseWhileStatement(node);\n case 'with':\n return parseWithStatement(node);\n default:\n break;\n }\n }\n\n expr = parseExpression();\n\n // ECMA-262 12.12 Labelled Statements\n if ((expr.type === Syntax.Identifier) && match(':')) {\n lex();\n\n key = '$' + expr.name;\n if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.Redeclaration, 'Label', expr.name);\n }\n\n state.labelSet[key] = true;\n labeledBody = parseStatement();\n delete state.labelSet[key];\n return node.finishLabeledStatement(expr, labeledBody);\n }\n\n consumeSemicolon();\n\n return node.finishExpressionStatement(expr);\n }\n\n // ECMA-262 14.1 Function Definition\n\n function parseFunctionSourceElements() {\n var statement, body = [], token, directive, firstRestricted,\n oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,\n node = new Node();\n\n expect('{');\n\n while (startIndex < length) {\n if (lookahead.type !== Token.StringLiteral) {\n break;\n }\n token = lookahead;\n\n statement = parseStatementListItem();\n body.push(statement);\n if (statement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n oldLabelSet = state.labelSet;\n oldInIteration = state.inIteration;\n oldInSwitch = state.inSwitch;\n oldInFunctionBody = state.inFunctionBody;\n oldParenthesisCount = state.parenthesizedCount;\n\n state.labelSet = {};\n state.inIteration = false;\n state.inSwitch = false;\n state.inFunctionBody = true;\n state.parenthesizedCount = 0;\n\n while (startIndex < length) {\n if (match('}')) {\n break;\n }\n body.push(parseStatementListItem());\n }\n\n expect('}');\n\n state.labelSet = oldLabelSet;\n state.inIteration = oldInIteration;\n state.inSwitch = oldInSwitch;\n state.inFunctionBody = oldInFunctionBody;\n state.parenthesizedCount = oldParenthesisCount;\n\n return node.finishBlockStatement(body);\n }\n\n function validateParam(options, param, name) {\n var key = '$' + name;\n if (strict) {\n if (isRestrictedWord(name)) {\n options.stricted = param;\n options.message = Messages.StrictParamName;\n }\n if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {\n options.stricted = param;\n options.message = Messages.StrictParamDupe;\n }\n } else if (!options.firstRestricted) {\n if (isRestrictedWord(name)) {\n options.firstRestricted = param;\n options.message = Messages.StrictParamName;\n } else if (isStrictModeReservedWord(name)) {\n options.firstRestricted = param;\n options.message = Messages.StrictReservedWord;\n } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {\n options.stricted = param;\n options.message = Messages.StrictParamDupe;\n }\n }\n options.paramSet[key] = true;\n }\n\n function parseParam(options) {\n var token, param, params = [], i, def;\n\n token = lookahead;\n if (token.value === '...') {\n param = parseRestElement(params);\n validateParam(options, param.argument, param.argument.name);\n options.params.push(param);\n options.defaults.push(null);\n return false;\n }\n\n param = parsePatternWithDefault(params);\n for (i = 0; i < params.length; i++) {\n validateParam(options, params[i], params[i].value);\n }\n\n if (param.type === Syntax.AssignmentPattern) {\n def = param.right;\n param = param.left;\n ++options.defaultCount;\n }\n\n options.params.push(param);\n options.defaults.push(def);\n\n return !match(')');\n }\n\n function parseParams(firstRestricted) {\n var options;\n\n options = {\n params: [],\n defaultCount: 0,\n defaults: [],\n firstRestricted: firstRestricted\n };\n\n expect('(');\n\n if (!match(')')) {\n options.paramSet = {};\n while (startIndex < length) {\n if (!parseParam(options)) {\n break;\n }\n expect(',');\n }\n }\n\n expect(')');\n\n if (options.defaultCount === 0) {\n options.defaults = [];\n }\n\n return {\n params: options.params,\n defaults: options.defaults,\n stricted: options.stricted,\n firstRestricted: options.firstRestricted,\n message: options.message\n };\n }\n\n function parseFunctionDeclaration(node, identifierIsOptional) {\n var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict,\n isGenerator, previousAllowYield;\n\n previousAllowYield = state.allowYield;\n\n expectKeyword('function');\n\n isGenerator = match('*');\n if (isGenerator) {\n lex();\n }\n\n if (!identifierIsOptional || !match('(')) {\n token = lookahead;\n id = parseVariableIdentifier();\n if (strict) {\n if (isRestrictedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictFunctionName);\n }\n } else {\n if (isRestrictedWord(token.value)) {\n firstRestricted = token;\n message = Messages.StrictFunctionName;\n } else if (isStrictModeReservedWord(token.value)) {\n firstRestricted = token;\n message = Messages.StrictReservedWord;\n }\n }\n }\n\n state.allowYield = !isGenerator;\n tmp = parseParams(firstRestricted);\n params = tmp.params;\n defaults = tmp.defaults;\n stricted = tmp.stricted;\n firstRestricted = tmp.firstRestricted;\n if (tmp.message) {\n message = tmp.message;\n }\n\n\n previousStrict = strict;\n body = parseFunctionSourceElements();\n if (strict && firstRestricted) {\n throwUnexpectedToken(firstRestricted, message);\n }\n if (strict && stricted) {\n tolerateUnexpectedToken(stricted, message);\n }\n\n strict = previousStrict;\n state.allowYield = previousAllowYield;\n\n return node.finishFunctionDeclaration(id, params, defaults, body, isGenerator);\n }\n\n function parseFunctionExpression() {\n var token, id = null, stricted, firstRestricted, message, tmp,\n params = [], defaults = [], body, previousStrict, node = new Node(),\n isGenerator, previousAllowYield;\n\n previousAllowYield = state.allowYield;\n\n expectKeyword('function');\n\n isGenerator = match('*');\n if (isGenerator) {\n lex();\n }\n\n state.allowYield = !isGenerator;\n if (!match('(')) {\n token = lookahead;\n id = (!strict && !isGenerator && matchKeyword('yield')) ? parseNonComputedProperty() : parseVariableIdentifier();\n if (strict) {\n if (isRestrictedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictFunctionName);\n }\n } else {\n if (isRestrictedWord(token.value)) {\n firstRestricted = token;\n message = Messages.StrictFunctionName;\n } else if (isStrictModeReservedWord(token.value)) {\n firstRestricted = token;\n message = Messages.StrictReservedWord;\n }\n }\n }\n\n tmp = parseParams(firstRestricted);\n params = tmp.params;\n defaults = tmp.defaults;\n stricted = tmp.stricted;\n firstRestricted = tmp.firstRestricted;\n if (tmp.message) {\n message = tmp.message;\n }\n\n previousStrict = strict;\n body = parseFunctionSourceElements();\n if (strict && firstRestricted) {\n throwUnexpectedToken(firstRestricted, message);\n }\n if (strict && stricted) {\n tolerateUnexpectedToken(stricted, message);\n }\n strict = previousStrict;\n state.allowYield = previousAllowYield;\n\n return node.finishFunctionExpression(id, params, defaults, body, isGenerator);\n }\n\n // ECMA-262 14.5 Class Definitions\n\n function parseClassBody() {\n var classBody, token, isStatic, hasConstructor = false, body, method, computed, key;\n\n classBody = new Node();\n\n expect('{');\n body = [];\n while (!match('}')) {\n if (match(';')) {\n lex();\n } else {\n method = new Node();\n token = lookahead;\n isStatic = false;\n computed = match('[');\n if (match('*')) {\n lex();\n } else {\n key = parseObjectPropertyKey();\n if (key.name === 'static' && (lookaheadPropertyName() || match('*'))) {\n token = lookahead;\n isStatic = true;\n computed = match('[');\n if (match('*')) {\n lex();\n } else {\n key = parseObjectPropertyKey();\n }\n }\n }\n method = tryParseMethodDefinition(token, key, computed, method);\n if (method) {\n method['static'] = isStatic; // jscs:ignore requireDotNotation\n if (method.kind === 'init') {\n method.kind = 'method';\n }\n if (!isStatic) {\n if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') {\n if (method.kind !== 'method' || !method.method || method.value.generator) {\n throwUnexpectedToken(token, Messages.ConstructorSpecialMethod);\n }\n if (hasConstructor) {\n throwUnexpectedToken(token, Messages.DuplicateConstructor);\n } else {\n hasConstructor = true;\n }\n method.kind = 'constructor';\n }\n } else {\n if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') {\n throwUnexpectedToken(token, Messages.StaticPrototype);\n }\n }\n method.type = Syntax.MethodDefinition;\n delete method.method;\n delete method.shorthand;\n body.push(method);\n } else {\n throwUnexpectedToken(lookahead);\n }\n }\n }\n lex();\n return classBody.finishClassBody(body);\n }\n\n function parseClassDeclaration(identifierIsOptional) {\n var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;\n strict = true;\n\n expectKeyword('class');\n\n if (!identifierIsOptional || lookahead.type === Token.Identifier) {\n id = parseVariableIdentifier();\n }\n\n if (matchKeyword('extends')) {\n lex();\n superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);\n }\n classBody = parseClassBody();\n strict = previousStrict;\n\n return classNode.finishClassDeclaration(id, superClass, classBody);\n }\n\n function parseClassExpression() {\n var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;\n strict = true;\n\n expectKeyword('class');\n\n if (lookahead.type === Token.Identifier) {\n id = parseVariableIdentifier();\n }\n\n if (matchKeyword('extends')) {\n lex();\n superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);\n }\n classBody = parseClassBody();\n strict = previousStrict;\n\n return classNode.finishClassExpression(id, superClass, classBody);\n }\n\n // ECMA-262 15.2 Modules\n\n function parseModuleSpecifier() {\n var node = new Node();\n\n if (lookahead.type !== Token.StringLiteral) {\n throwError(Messages.InvalidModuleSpecifier);\n }\n return node.finishLiteral(lex());\n }\n\n // ECMA-262 15.2.3 Exports\n\n function parseExportSpecifier() {\n var exported, local, node = new Node(), def;\n if (matchKeyword('default')) {\n // export {default} from 'something';\n def = new Node();\n lex();\n local = def.finishIdentifier('default');\n } else {\n local = parseVariableIdentifier();\n }\n if (matchContextualKeyword('as')) {\n lex();\n exported = parseNonComputedProperty();\n }\n return node.finishExportSpecifier(local, exported);\n }\n\n function parseExportNamedDeclaration(node) {\n var declaration = null,\n isExportFromIdentifier,\n src = null, specifiers = [];\n\n // non-default export\n if (lookahead.type === Token.Keyword) {\n // covers:\n // export var f = 1;\n switch (lookahead.value) {\n case 'let':\n case 'const':\n declaration = parseLexicalDeclaration({inFor: false});\n return node.finishExportNamedDeclaration(declaration, specifiers, null);\n case 'var':\n case 'class':\n case 'function':\n declaration = parseStatementListItem();\n return node.finishExportNamedDeclaration(declaration, specifiers, null);\n }\n }\n\n expect('{');\n while (!match('}')) {\n isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');\n specifiers.push(parseExportSpecifier());\n if (!match('}')) {\n expect(',');\n if (match('}')) {\n break;\n }\n }\n }\n expect('}');\n\n if (matchContextualKeyword('from')) {\n // covering:\n // export {default} from 'foo';\n // export {foo} from 'foo';\n lex();\n src = parseModuleSpecifier();\n consumeSemicolon();\n } else if (isExportFromIdentifier) {\n // covering:\n // export {default}; // missing fromClause\n throwError(lookahead.value ?\n Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);\n } else {\n // cover\n // export {foo};\n consumeSemicolon();\n }\n return node.finishExportNamedDeclaration(declaration, specifiers, src);\n }\n\n function parseExportDefaultDeclaration(node) {\n var declaration = null,\n expression = null;\n\n // covers:\n // export default ...\n expectKeyword('default');\n\n if (matchKeyword('function')) {\n // covers:\n // export default function foo () {}\n // export default function () {}\n declaration = parseFunctionDeclaration(new Node(), true);\n return node.finishExportDefaultDeclaration(declaration);\n }\n if (matchKeyword('class')) {\n declaration = parseClassDeclaration(true);\n return node.finishExportDefaultDeclaration(declaration);\n }\n\n if (matchContextualKeyword('from')) {\n throwError(Messages.UnexpectedToken, lookahead.value);\n }\n\n // covers:\n // export default {};\n // export default [];\n // export default (1 + 2);\n if (match('{')) {\n expression = parseObjectInitializer();\n } else if (match('[')) {\n expression = parseArrayInitializer();\n } else {\n expression = parseAssignmentExpression();\n }\n consumeSemicolon();\n return node.finishExportDefaultDeclaration(expression);\n }\n\n function parseExportAllDeclaration(node) {\n var src;\n\n // covers:\n // export * from 'foo';\n expect('*');\n if (!matchContextualKeyword('from')) {\n throwError(lookahead.value ?\n Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);\n }\n lex();\n src = parseModuleSpecifier();\n consumeSemicolon();\n\n return node.finishExportAllDeclaration(src);\n }\n\n function parseExportDeclaration() {\n var node = new Node();\n if (state.inFunctionBody) {\n throwError(Messages.IllegalExportDeclaration);\n }\n\n expectKeyword('export');\n\n if (matchKeyword('default')) {\n return parseExportDefaultDeclaration(node);\n }\n if (match('*')) {\n return parseExportAllDeclaration(node);\n }\n return parseExportNamedDeclaration(node);\n }\n\n // ECMA-262 15.2.2 Imports\n\n function parseImportSpecifier() {\n // import {} ...;\n var local, imported, node = new Node();\n\n imported = parseNonComputedProperty();\n if (matchContextualKeyword('as')) {\n lex();\n local = parseVariableIdentifier();\n }\n\n return node.finishImportSpecifier(local, imported);\n }\n\n function parseNamedImports() {\n var specifiers = [];\n // {foo, bar as bas}\n expect('{');\n while (!match('}')) {\n specifiers.push(parseImportSpecifier());\n if (!match('}')) {\n expect(',');\n if (match('}')) {\n break;\n }\n }\n }\n expect('}');\n return specifiers;\n }\n\n function parseImportDefaultSpecifier() {\n // import ...;\n var local, node = new Node();\n\n local = parseNonComputedProperty();\n\n return node.finishImportDefaultSpecifier(local);\n }\n\n function parseImportNamespaceSpecifier() {\n // import <* as foo> ...;\n var local, node = new Node();\n\n expect('*');\n if (!matchContextualKeyword('as')) {\n throwError(Messages.NoAsAfterImportNamespace);\n }\n lex();\n local = parseNonComputedProperty();\n\n return node.finishImportNamespaceSpecifier(local);\n }\n\n function parseImportDeclaration() {\n var specifiers = [], src, node = new Node();\n\n if (state.inFunctionBody) {\n throwError(Messages.IllegalImportDeclaration);\n }\n\n expectKeyword('import');\n\n if (lookahead.type === Token.StringLiteral) {\n // import 'foo';\n src = parseModuleSpecifier();\n } else {\n\n if (match('{')) {\n // import {bar}\n specifiers = specifiers.concat(parseNamedImports());\n } else if (match('*')) {\n // import * as foo\n specifiers.push(parseImportNamespaceSpecifier());\n } else if (isIdentifierName(lookahead) && !matchKeyword('default')) {\n // import foo\n specifiers.push(parseImportDefaultSpecifier());\n if (match(',')) {\n lex();\n if (match('*')) {\n // import foo, * as foo\n specifiers.push(parseImportNamespaceSpecifier());\n } else if (match('{')) {\n // import foo, {bar}\n specifiers = specifiers.concat(parseNamedImports());\n } else {\n throwUnexpectedToken(lookahead);\n }\n }\n } else {\n throwUnexpectedToken(lex());\n }\n\n if (!matchContextualKeyword('from')) {\n throwError(lookahead.value ?\n Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);\n }\n lex();\n src = parseModuleSpecifier();\n }\n\n consumeSemicolon();\n return node.finishImportDeclaration(specifiers, src);\n }\n\n // ECMA-262 15.1 Scripts\n\n function parseScriptBody() {\n var statement, body = [], token, directive, firstRestricted;\n\n while (startIndex < length) {\n token = lookahead;\n if (token.type !== Token.StringLiteral) {\n break;\n }\n\n statement = parseStatementListItem();\n body.push(statement);\n if (statement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n while (startIndex < length) {\n statement = parseStatementListItem();\n /* istanbul ignore if */\n if (typeof statement === 'undefined') {\n break;\n }\n body.push(statement);\n }\n return body;\n }\n\n function parseProgram() {\n var body, node;\n\n peek();\n node = new Node();\n\n body = parseScriptBody();\n return node.finishProgram(body, state.sourceType);\n }\n\n function filterTokenLocation() {\n var i, entry, token, tokens = [];\n\n for (i = 0; i < extra.tokens.length; ++i) {\n entry = extra.tokens[i];\n token = {\n type: entry.type,\n value: entry.value\n };\n if (entry.regex) {\n token.regex = {\n pattern: entry.regex.pattern,\n flags: entry.regex.flags\n };\n }\n if (extra.range) {\n token.range = entry.range;\n }\n if (extra.loc) {\n token.loc = entry.loc;\n }\n tokens.push(token);\n }\n\n extra.tokens = tokens;\n }\n\n function tokenize(code, options, delegate) {\n var toString,\n tokens;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n startIndex = index;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n allowYield: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1,\n curlyStack: []\n };\n\n extra = {};\n\n // Options matching.\n options = options || {};\n\n // Of course we collect tokens here.\n options.tokens = true;\n extra.tokens = [];\n extra.tokenValues = [];\n extra.tokenize = true;\n extra.delegate = delegate;\n\n // The following two fields are necessary to compute the Regex tokens.\n extra.openParenToken = -1;\n extra.openCurlyToken = -1;\n\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (typeof options.comment === 'boolean' && options.comment) {\n extra.comments = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n\n try {\n peek();\n if (lookahead.type === Token.EOF) {\n return extra.tokens;\n }\n\n lex();\n while (lookahead.type !== Token.EOF) {\n try {\n lex();\n } catch (lexError) {\n if (extra.errors) {\n recordError(lexError);\n // We have to break on the first error\n // to avoid infinite loops.\n break;\n } else {\n throw lexError;\n }\n }\n }\n\n tokens = extra.tokens;\n if (typeof extra.errors !== 'undefined') {\n tokens.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n return tokens;\n }\n\n function parse(code, options) {\n var program, toString;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n startIndex = index;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n allowYield: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1,\n curlyStack: [],\n sourceType: 'script'\n };\n strict = false;\n\n extra = {};\n if (typeof options !== 'undefined') {\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;\n\n if (extra.loc && options.source !== null && options.source !== undefined) {\n extra.source = toString(options.source);\n }\n\n if (typeof options.tokens === 'boolean' && options.tokens) {\n extra.tokens = [];\n }\n if (typeof options.comment === 'boolean' && options.comment) {\n extra.comments = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n if (extra.attachComment) {\n extra.range = true;\n extra.comments = [];\n extra.bottomRightStack = [];\n extra.trailingComments = [];\n extra.leadingComments = [];\n }\n if (options.sourceType === 'module') {\n // very restrictive condition for now\n state.sourceType = options.sourceType;\n strict = true;\n }\n }\n\n try {\n program = parseProgram();\n if (typeof extra.comments !== 'undefined') {\n program.comments = extra.comments;\n }\n if (typeof extra.tokens !== 'undefined') {\n filterTokenLocation();\n program.tokens = extra.tokens;\n }\n if (typeof extra.errors !== 'undefined') {\n program.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n\n return program;\n }\n\n // Sync with *.json manifests.\n exports.version = '2.7.1';\n\n exports.tokenize = tokenize;\n\n exports.parse = parse;\n\n // Deep copy.\n /* istanbul ignore next */\n exports.Syntax = (function () {\n var name, types = {};\n\n if (typeof Object.create === 'function') {\n types = Object.create(null);\n }\n\n for (name in Syntax) {\n if (Syntax.hasOwnProperty(name)) {\n types[name] = Syntax[name];\n }\n }\n\n if (typeof Object.freeze === 'function') {\n Object.freeze(types);\n }\n\n return types;\n }());\n\n}));\n/* vim: set sw=4 ts=4 et tw=80 : */\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n }\n throw TypeError('Uncaught, unspecified \"error\" event.');\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n", "var http = require('http');\n\nvar https = module.exports;\n\nfor (var key in http) {\n if (http.hasOwnProperty(key)) https[key] = http[key];\n};\n\nhttps.request = function (params, cb) {\n if (!params) params = {};\n params.scheme = 'https';\n params.protocol = 'https:';\n return http.request.call(this, params, cb);\n}\n", "exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n", + "/*!\n * node-inherit\n * Copyright(c) 2011 Dmitry Filatov \n * MIT Licensed\n */\n\nmodule.exports = require('./lib/inherit');\n", + "/**\n * @module inherit\n * @version 2.2.2\n * @author Filatov Dmitry \n * @description This module provides some syntax sugar for \"class\" declarations, constructors, mixins, \"super\" calls and static members.\n */\n\n(function(global) {\n\nvar hasIntrospection = (function(){'_';}).toString().indexOf('_') > -1,\n emptyBase = function() {},\n hasOwnProperty = Object.prototype.hasOwnProperty,\n objCreate = Object.create || function(ptp) {\n var inheritance = function() {};\n inheritance.prototype = ptp;\n return new inheritance();\n },\n objKeys = Object.keys || function(obj) {\n var res = [];\n for(var i in obj) {\n hasOwnProperty.call(obj, i) && res.push(i);\n }\n return res;\n },\n extend = function(o1, o2) {\n for(var i in o2) {\n hasOwnProperty.call(o2, i) && (o1[i] = o2[i]);\n }\n\n return o1;\n },\n toStr = Object.prototype.toString,\n isArray = Array.isArray || function(obj) {\n return toStr.call(obj) === '[object Array]';\n },\n isFunction = function(obj) {\n return toStr.call(obj) === '[object Function]';\n },\n noOp = function() {},\n needCheckProps = true,\n testPropObj = { toString : '' };\n\nfor(var i in testPropObj) { // fucking ie hasn't toString, valueOf in for\n testPropObj.hasOwnProperty(i) && (needCheckProps = false);\n}\n\nvar specProps = needCheckProps? ['toString', 'valueOf'] : null;\n\nfunction getPropList(obj) {\n var res = objKeys(obj);\n if(needCheckProps) {\n var specProp, i = 0;\n while(specProp = specProps[i++]) {\n obj.hasOwnProperty(specProp) && res.push(specProp);\n }\n }\n\n return res;\n}\n\nfunction override(base, res, add) {\n var addList = getPropList(add),\n j = 0, len = addList.length,\n name, prop;\n while(j < len) {\n if((name = addList[j++]) === '__self') {\n continue;\n }\n prop = add[name];\n if(isFunction(prop) &&\n (!hasIntrospection || prop.toString().indexOf('.__base') > -1)) {\n res[name] = (function(name, prop) {\n var baseMethod = base[name]?\n base[name] :\n name === '__constructor'? // case of inheritance from plane function\n res.__self.__parent :\n noOp;\n return function() {\n var baseSaved = this.__base;\n this.__base = baseMethod;\n var res = prop.apply(this, arguments);\n this.__base = baseSaved;\n return res;\n };\n })(name, prop);\n } else {\n res[name] = prop;\n }\n }\n}\n\nfunction applyMixins(mixins, res) {\n var i = 1, mixin;\n while(mixin = mixins[i++]) {\n res?\n isFunction(mixin)?\n inherit.self(res, mixin.prototype, mixin) :\n inherit.self(res, mixin) :\n res = isFunction(mixin)?\n inherit(mixins[0], mixin.prototype, mixin) :\n inherit(mixins[0], mixin);\n }\n return res || mixins[0];\n}\n\n/**\n* Creates class\n* @exports\n* @param {Function|Array} [baseClass|baseClassAndMixins] class (or class and mixins) to inherit from\n* @param {Object} prototypeFields\n* @param {Object} [staticFields]\n* @returns {Function} class\n*/\nfunction inherit() {\n var args = arguments,\n withMixins = isArray(args[0]),\n hasBase = withMixins || isFunction(args[0]),\n base = hasBase? withMixins? applyMixins(args[0]) : args[0] : emptyBase,\n props = args[hasBase? 1 : 0] || {},\n staticProps = args[hasBase? 2 : 1],\n res = props.__constructor || (hasBase && base.prototype.__constructor)?\n function() {\n return this.__constructor.apply(this, arguments);\n } :\n hasBase?\n function() {\n return base.apply(this, arguments);\n } :\n function() {};\n\n if(!hasBase) {\n res.prototype = props;\n res.prototype.__self = res.prototype.constructor = res;\n return extend(res, staticProps);\n }\n\n extend(res, base);\n\n res.__parent = base;\n\n var basePtp = base.prototype,\n resPtp = res.prototype = objCreate(basePtp);\n\n resPtp.__self = resPtp.constructor = res;\n\n props && override(basePtp, resPtp, props);\n staticProps && override(base, res, staticProps);\n\n return res;\n}\n\ninherit.self = function() {\n var args = arguments,\n withMixins = isArray(args[0]),\n base = withMixins? applyMixins(args[0], args[0][0]) : args[0],\n props = args[1],\n staticProps = args[2],\n basePtp = base.prototype;\n\n props && override(basePtp, basePtp, props);\n staticProps && override(base, base, staticProps);\n\n return base;\n};\n\nvar defineAsGlobal = true;\nif(typeof exports === 'object') {\n module.exports = inherit;\n defineAsGlobal = false;\n}\n\nif(typeof modules === 'object') {\n modules.define('inherit', function(provide) {\n provide(inherit);\n });\n defineAsGlobal = false;\n}\n\nif(typeof define === 'function') {\n define(function(require, exports, module) {\n module.exports = inherit;\n });\n defineAsGlobal = false;\n}\n\ndefineAsGlobal && (global.inherit = inherit);\n\n})(this);\n", "if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n", "/**\n * Determine if an object is Buffer\n *\n * Author: Feross Aboukhadijeh \n * License: MIT\n *\n * `npm install is-buffer`\n */\n\nmodule.exports = function (obj) {\n return !!(obj != null &&\n (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)\n (obj.constructor &&\n typeof obj.constructor.isBuffer === 'function' &&\n obj.constructor.isBuffer(obj))\n ))\n}\n", - "var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n", + "module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n", "'use strict';\n\n\nvar yaml = require('./lib/js-yaml.js');\n\n\nmodule.exports = yaml;\n", "'use strict';\n\n\nvar loader = require('./js-yaml/loader');\nvar dumper = require('./js-yaml/dumper');\n\n\nfunction deprecated(name) {\n return function () {\n throw new Error('Function ' + name + ' is deprecated and cannot be used.');\n };\n}\n\n\nmodule.exports.Type = require('./js-yaml/type');\nmodule.exports.Schema = require('./js-yaml/schema');\nmodule.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');\nmodule.exports.JSON_SCHEMA = require('./js-yaml/schema/json');\nmodule.exports.CORE_SCHEMA = require('./js-yaml/schema/core');\nmodule.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');\nmodule.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');\nmodule.exports.load = loader.load;\nmodule.exports.loadAll = loader.loadAll;\nmodule.exports.safeLoad = loader.safeLoad;\nmodule.exports.safeLoadAll = loader.safeLoadAll;\nmodule.exports.dump = dumper.dump;\nmodule.exports.safeDump = dumper.safeDump;\nmodule.exports.YAMLException = require('./js-yaml/exception');\n\n// Deprecated schema names from JS-YAML 2.0.x\nmodule.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');\nmodule.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');\nmodule.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');\n\n// Deprecated functions from JS-YAML 1.x.x\nmodule.exports.scan = deprecated('scan');\nmodule.exports.parse = deprecated('parse');\nmodule.exports.compose = deprecated('compose');\nmodule.exports.addConstructor = deprecated('addConstructor');\n", - "'use strict';\n\n\nfunction isNothing(subject) {\n return (typeof subject === 'undefined') || (subject === null);\n}\n\n\nfunction isObject(subject) {\n return (typeof subject === 'object') && (subject !== null);\n}\n\n\nfunction toArray(sequence) {\n if (Array.isArray(sequence)) return sequence;\n else if (isNothing(sequence)) return [];\n\n return [ sequence ];\n}\n\n\nfunction extend(target, source) {\n var index, length, key, sourceKeys;\n\n if (source) {\n sourceKeys = Object.keys(source);\n\n for (index = 0, length = sourceKeys.length; index < length; index += 1) {\n key = sourceKeys[index];\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n\nfunction repeat(string, count) {\n var result = '', cycle;\n\n for (cycle = 0; cycle < count; cycle += 1) {\n result += string;\n }\n\n return result;\n}\n\n\nfunction isNegativeZero(number) {\n return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);\n}\n\n\nmodule.exports.isNothing = isNothing;\nmodule.exports.isObject = isObject;\nmodule.exports.toArray = toArray;\nmodule.exports.repeat = repeat;\nmodule.exports.isNegativeZero = isNegativeZero;\nmodule.exports.extend = extend;\n", - "'use strict';\n\n/*eslint-disable no-use-before-define*/\n\nvar common = require('./common');\nvar YAMLException = require('./exception');\nvar DEFAULT_FULL_SCHEMA = require('./schema/default_full');\nvar DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');\n\nvar _toString = Object.prototype.toString;\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar CHAR_TAB = 0x09; /* Tab */\nvar CHAR_LINE_FEED = 0x0A; /* LF */\nvar CHAR_CARRIAGE_RETURN = 0x0D; /* CR */\nvar CHAR_SPACE = 0x20; /* Space */\nvar CHAR_EXCLAMATION = 0x21; /* ! */\nvar CHAR_DOUBLE_QUOTE = 0x22; /* \" */\nvar CHAR_SHARP = 0x23; /* # */\nvar CHAR_PERCENT = 0x25; /* % */\nvar CHAR_AMPERSAND = 0x26; /* & */\nvar CHAR_SINGLE_QUOTE = 0x27; /* ' */\nvar CHAR_ASTERISK = 0x2A; /* * */\nvar CHAR_COMMA = 0x2C; /* , */\nvar CHAR_MINUS = 0x2D; /* - */\nvar CHAR_COLON = 0x3A; /* : */\nvar CHAR_GREATER_THAN = 0x3E; /* > */\nvar CHAR_QUESTION = 0x3F; /* ? */\nvar CHAR_COMMERCIAL_AT = 0x40; /* @ */\nvar CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */\nvar CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */\nvar CHAR_GRAVE_ACCENT = 0x60; /* ` */\nvar CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */\nvar CHAR_VERTICAL_LINE = 0x7C; /* | */\nvar CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */\n\nvar ESCAPE_SEQUENCES = {};\n\nESCAPE_SEQUENCES[0x00] = '\\\\0';\nESCAPE_SEQUENCES[0x07] = '\\\\a';\nESCAPE_SEQUENCES[0x08] = '\\\\b';\nESCAPE_SEQUENCES[0x09] = '\\\\t';\nESCAPE_SEQUENCES[0x0A] = '\\\\n';\nESCAPE_SEQUENCES[0x0B] = '\\\\v';\nESCAPE_SEQUENCES[0x0C] = '\\\\f';\nESCAPE_SEQUENCES[0x0D] = '\\\\r';\nESCAPE_SEQUENCES[0x1B] = '\\\\e';\nESCAPE_SEQUENCES[0x22] = '\\\\\"';\nESCAPE_SEQUENCES[0x5C] = '\\\\\\\\';\nESCAPE_SEQUENCES[0x85] = '\\\\N';\nESCAPE_SEQUENCES[0xA0] = '\\\\_';\nESCAPE_SEQUENCES[0x2028] = '\\\\L';\nESCAPE_SEQUENCES[0x2029] = '\\\\P';\n\nvar DEPRECATED_BOOLEANS_SYNTAX = [\n 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',\n 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'\n];\n\nfunction compileStyleMap(schema, map) {\n var result, keys, index, length, tag, style, type;\n\n if (map === null) return {};\n\n result = {};\n keys = Object.keys(map);\n\n for (index = 0, length = keys.length; index < length; index += 1) {\n tag = keys[index];\n style = String(map[tag]);\n\n if (tag.slice(0, 2) === '!!') {\n tag = 'tag:yaml.org,2002:' + tag.slice(2);\n }\n\n type = schema.compiledTypeMap[tag];\n\n if (type && _hasOwnProperty.call(type.styleAliases, style)) {\n style = type.styleAliases[style];\n }\n\n result[tag] = style;\n }\n\n return result;\n}\n\nfunction encodeHex(character) {\n var string, handle, length;\n\n string = character.toString(16).toUpperCase();\n\n if (character <= 0xFF) {\n handle = 'x';\n length = 2;\n } else if (character <= 0xFFFF) {\n handle = 'u';\n length = 4;\n } else if (character <= 0xFFFFFFFF) {\n handle = 'U';\n length = 8;\n } else {\n throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');\n }\n\n return '\\\\' + handle + common.repeat('0', length - string.length) + string;\n}\n\nfunction State(options) {\n this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;\n this.indent = Math.max(1, (options['indent'] || 2));\n this.skipInvalid = options['skipInvalid'] || false;\n this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);\n this.styleMap = compileStyleMap(this.schema, options['styles'] || null);\n this.sortKeys = options['sortKeys'] || false;\n this.lineWidth = options['lineWidth'] || 80;\n this.noRefs = options['noRefs'] || false;\n this.noCompatMode = options['noCompatMode'] || false;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.explicitTypes = this.schema.compiledExplicit;\n\n this.tag = null;\n this.result = '';\n\n this.duplicates = [];\n this.usedDuplicates = null;\n}\n\nfunction indentString(string, spaces) {\n var ind = common.repeat(' ', spaces),\n position = 0,\n next = -1,\n result = '',\n line,\n length = string.length;\n\n while (position < length) {\n next = string.indexOf('\\n', position);\n if (next === -1) {\n line = string.slice(position);\n position = length;\n } else {\n line = string.slice(position, next + 1);\n position = next + 1;\n }\n\n if (line.length && line !== '\\n') result += ind;\n\n result += line;\n }\n\n return result;\n}\n\nfunction generateNextLine(state, level) {\n return '\\n' + common.repeat(' ', state.indent * level);\n}\n\nfunction testImplicitResolving(state, str) {\n var index, length, type;\n\n for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {\n type = state.implicitTypes[index];\n\n if (type.resolve(str)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction StringBuilder(source) {\n this.source = source;\n this.result = '';\n this.checkpoint = 0;\n}\n\nStringBuilder.prototype.takeUpTo = function (position) {\n var er;\n\n if (position < this.checkpoint) {\n er = new Error('position should be > checkpoint');\n er.position = position;\n er.checkpoint = this.checkpoint;\n throw er;\n }\n\n this.result += this.source.slice(this.checkpoint, position);\n this.checkpoint = position;\n return this;\n};\n\nStringBuilder.prototype.escapeChar = function () {\n var character, esc;\n\n character = this.source.charCodeAt(this.checkpoint);\n esc = ESCAPE_SEQUENCES[character] || encodeHex(character);\n this.result += esc;\n this.checkpoint += 1;\n\n return this;\n};\n\nStringBuilder.prototype.finish = function () {\n if (this.source.length > this.checkpoint) {\n this.takeUpTo(this.source.length);\n }\n};\n\nfunction writeScalar(state, object, level, iskey) {\n var simple, first, spaceWrap, folded, literal, single, double,\n sawLineFeed, linePosition, longestLine, indent, max, character,\n position, escapeSeq, hexEsc, previous, lineLength, modifier,\n trailingLineBreaks, result;\n\n if (object.length === 0) {\n state.dump = \"''\";\n return;\n }\n\n if (!state.noCompatMode &&\n DEPRECATED_BOOLEANS_SYNTAX.indexOf(object) !== -1) {\n state.dump = \"'\" + object + \"'\";\n return;\n }\n\n simple = true;\n first = object.length ? object.charCodeAt(0) : 0;\n spaceWrap = (CHAR_SPACE === first ||\n CHAR_SPACE === object.charCodeAt(object.length - 1));\n\n // Simplified check for restricted first characters\n // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29\n if (CHAR_MINUS === first ||\n CHAR_QUESTION === first ||\n CHAR_COMMERCIAL_AT === first ||\n CHAR_GRAVE_ACCENT === first) {\n simple = false;\n }\n\n // Can only use > and | if not wrapped in spaces or is not a key.\n // Also, don't use if in flow mode.\n if (spaceWrap || (state.flowLevel > -1 && state.flowLevel <= level)) {\n if (spaceWrap) simple = false;\n\n folded = false;\n literal = false;\n } else {\n folded = !iskey;\n literal = !iskey;\n }\n\n single = true;\n double = new StringBuilder(object);\n\n sawLineFeed = false;\n linePosition = 0;\n longestLine = 0;\n\n indent = state.indent * level;\n max = state.lineWidth;\n\n // Replace -1 with biggest ingeger number according to\n // http://ecma262-5.com/ELS5_HTML.htm#Section_8.5\n if (max === -1) max = 9007199254740991;\n\n if (indent < 40) max -= indent;\n else max = 40;\n\n for (position = 0; position < object.length; position++) {\n character = object.charCodeAt(position);\n if (simple) {\n // Characters that can never appear in the simple scalar\n if (!simpleChar(character)) {\n simple = false;\n } else {\n // Still simple. If we make it all the way through like\n // this, then we can just dump the string as-is.\n continue;\n }\n }\n\n if (single && character === CHAR_SINGLE_QUOTE) {\n single = false;\n }\n\n escapeSeq = ESCAPE_SEQUENCES[character];\n hexEsc = needsHexEscape(character);\n\n if (!escapeSeq && !hexEsc) {\n continue;\n }\n\n if (character !== CHAR_LINE_FEED &&\n character !== CHAR_DOUBLE_QUOTE &&\n character !== CHAR_SINGLE_QUOTE) {\n folded = false;\n literal = false;\n } else if (character === CHAR_LINE_FEED) {\n sawLineFeed = true;\n single = false;\n if (position > 0) {\n previous = object.charCodeAt(position - 1);\n if (previous === CHAR_SPACE) {\n literal = false;\n folded = false;\n }\n }\n if (folded) {\n lineLength = position - linePosition;\n linePosition = position;\n if (lineLength > longestLine) longestLine = lineLength;\n }\n }\n\n if (character !== CHAR_DOUBLE_QUOTE) single = false;\n\n double.takeUpTo(position);\n double.escapeChar();\n }\n\n if (simple && testImplicitResolving(state, object)) simple = false;\n\n modifier = '';\n if (folded || literal) {\n trailingLineBreaks = 0;\n if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) {\n trailingLineBreaks += 1;\n if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) {\n trailingLineBreaks += 1;\n }\n }\n\n if (trailingLineBreaks === 0) modifier = '-';\n else if (trailingLineBreaks === 2) modifier = '+';\n }\n\n if (literal && longestLine < max || state.tag !== null) {\n folded = false;\n }\n\n // If it's literally one line, then don't bother with the literal.\n // We may still want to do a fold, though, if it's a super long line.\n if (!sawLineFeed) literal = false;\n\n if (simple) {\n state.dump = object;\n } else if (single) {\n state.dump = '\\'' + object + '\\'';\n } else if (folded) {\n result = fold(object, max);\n state.dump = '>' + modifier + '\\n' + indentString(result, indent);\n } else if (literal) {\n if (!modifier) object = object.replace(/\\n$/, '');\n state.dump = '|' + modifier + '\\n' + indentString(object, indent);\n } else if (double) {\n double.finish();\n state.dump = '\"' + double.result + '\"';\n } else {\n throw new Error('Failed to dump scalar value');\n }\n\n return;\n}\n\n// The `trailing` var is a regexp match of any trailing `\\n` characters.\n//\n// There are three cases we care about:\n//\n// 1. One trailing `\\n` on the string. Just use `|` or `>`.\n// This is the assumed default. (trailing = null)\n// 2. No trailing `\\n` on the string. Use `|-` or `>-` to \"chomp\" the end.\n// 3. More than one trailing `\\n` on the string. Use `|+` or `>+`.\n//\n// In the case of `>+`, these line breaks are *not* doubled (like the line\n// breaks within the string), so it's important to only end with the exact\n// same number as we started.\nfunction fold(object, max) {\n var result = '',\n position = 0,\n length = object.length,\n trailing = /\\n+$/.exec(object),\n newLine;\n\n if (trailing) {\n length = trailing.index + 1;\n }\n\n while (position < length) {\n newLine = object.indexOf('\\n', position);\n if (newLine > length || newLine === -1) {\n if (result) result += '\\n\\n';\n result += foldLine(object.slice(position, length), max);\n position = length;\n\n } else {\n if (result) result += '\\n\\n';\n result += foldLine(object.slice(position, newLine), max);\n position = newLine + 1;\n }\n }\n\n if (trailing && trailing[0] !== '\\n') result += trailing[0];\n\n return result;\n}\n\nfunction foldLine(line, max) {\n if (line === '') return line;\n\n var foldRe = /[^\\s] [^\\s]/g,\n result = '',\n prevMatch = 0,\n foldStart = 0,\n match = foldRe.exec(line),\n index,\n foldEnd,\n folded;\n\n while (match) {\n index = match.index;\n\n // when we cross the max len, if the previous match would've\n // been ok, use that one, and carry on. If there was no previous\n // match on this fold section, then just have a long line.\n if (index - foldStart > max) {\n if (prevMatch !== foldStart) foldEnd = prevMatch;\n else foldEnd = index;\n\n if (result) result += '\\n';\n folded = line.slice(foldStart, foldEnd);\n result += folded;\n foldStart = foldEnd + 1;\n }\n prevMatch = index + 1;\n match = foldRe.exec(line);\n }\n\n if (result) result += '\\n';\n\n // if we end up with one last word at the end, then the last bit might\n // be slightly bigger than we wanted, because we exited out of the loop.\n if (foldStart !== prevMatch && line.length - foldStart > max) {\n result += line.slice(foldStart, prevMatch) + '\\n' +\n line.slice(prevMatch + 1);\n } else {\n result += line.slice(foldStart);\n }\n\n return result;\n}\n\n// Returns true if character can be found in a simple scalar\nfunction simpleChar(character) {\n return CHAR_TAB !== character &&\n CHAR_LINE_FEED !== character &&\n CHAR_CARRIAGE_RETURN !== character &&\n CHAR_COMMA !== character &&\n CHAR_LEFT_SQUARE_BRACKET !== character &&\n CHAR_RIGHT_SQUARE_BRACKET !== character &&\n CHAR_LEFT_CURLY_BRACKET !== character &&\n CHAR_RIGHT_CURLY_BRACKET !== character &&\n CHAR_SHARP !== character &&\n CHAR_AMPERSAND !== character &&\n CHAR_ASTERISK !== character &&\n CHAR_EXCLAMATION !== character &&\n CHAR_VERTICAL_LINE !== character &&\n CHAR_GREATER_THAN !== character &&\n CHAR_SINGLE_QUOTE !== character &&\n CHAR_DOUBLE_QUOTE !== character &&\n CHAR_PERCENT !== character &&\n CHAR_COLON !== character &&\n !ESCAPE_SEQUENCES[character] &&\n !needsHexEscape(character);\n}\n\n// Returns true if the character code needs to be escaped.\nfunction needsHexEscape(character) {\n return !((0x00020 <= character && character <= 0x00007E) ||\n (character === 0x00085) ||\n (0x000A0 <= character && character <= 0x00D7FF) ||\n (0x0E000 <= character && character <= 0x00FFFD) ||\n (0x10000 <= character && character <= 0x10FFFF));\n}\n\nfunction writeFlowSequence(state, level, object) {\n var _result = '',\n _tag = state.tag,\n index,\n length;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n // Write only valid elements.\n if (writeNode(state, level, object[index], false, false)) {\n if (index !== 0) _result += ', ';\n _result += state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = '[' + _result + ']';\n}\n\nfunction writeBlockSequence(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n index,\n length;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n // Write only valid elements.\n if (writeNode(state, level + 1, object[index], true, true)) {\n if (!compact || index !== 0) {\n _result += generateNextLine(state, level);\n }\n _result += '- ' + state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = _result || '[]'; // Empty sequence if no valid values.\n}\n\nfunction writeFlowMapping(state, level, object) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n pairBuffer;\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n pairBuffer = '';\n\n if (index !== 0) pairBuffer += ', ';\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (!writeNode(state, level, objectKey, false, false)) {\n continue; // Skip this pair because of invalid key;\n }\n\n if (state.dump.length > 1024) pairBuffer += '? ';\n\n pairBuffer += state.dump + ': ';\n\n if (!writeNode(state, level, objectValue, false, false)) {\n continue; // Skip this pair because of invalid value.\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = '{' + _result + '}';\n}\n\nfunction writeBlockMapping(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n explicitPair,\n pairBuffer;\n\n // Allow sorting keys so that the output file is deterministic\n if (state.sortKeys === true) {\n // Default sorting\n objectKeyList.sort();\n } else if (typeof state.sortKeys === 'function') {\n // Custom sort function\n objectKeyList.sort(state.sortKeys);\n } else if (state.sortKeys) {\n // Something is wrong\n throw new YAMLException('sortKeys must be a boolean or a function');\n }\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n pairBuffer = '';\n\n if (!compact || index !== 0) {\n pairBuffer += generateNextLine(state, level);\n }\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (!writeNode(state, level + 1, objectKey, true, true, true)) {\n continue; // Skip this pair because of invalid key.\n }\n\n explicitPair = (state.tag !== null && state.tag !== '?') ||\n (state.dump && state.dump.length > 1024);\n\n if (explicitPair) {\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += '?';\n } else {\n pairBuffer += '? ';\n }\n }\n\n pairBuffer += state.dump;\n\n if (explicitPair) {\n pairBuffer += generateNextLine(state, level);\n }\n\n if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {\n continue; // Skip this pair because of invalid value.\n }\n\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += ':';\n } else {\n pairBuffer += ': ';\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = _result || '{}'; // Empty mapping if no valid pairs.\n}\n\nfunction detectType(state, object, explicit) {\n var _result, typeList, index, length, type, style;\n\n typeList = explicit ? state.explicitTypes : state.implicitTypes;\n\n for (index = 0, length = typeList.length; index < length; index += 1) {\n type = typeList[index];\n\n if ((type.instanceOf || type.predicate) &&\n (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&\n (!type.predicate || type.predicate(object))) {\n\n state.tag = explicit ? type.tag : '?';\n\n if (type.represent) {\n style = state.styleMap[type.tag] || type.defaultStyle;\n\n if (_toString.call(type.represent) === '[object Function]') {\n _result = type.represent(object, style);\n } else if (_hasOwnProperty.call(type.represent, style)) {\n _result = type.represent[style](object, style);\n } else {\n throw new YAMLException('!<' + type.tag + '> tag resolver accepts not \"' + style + '\" style');\n }\n\n state.dump = _result;\n }\n\n return true;\n }\n }\n\n return false;\n}\n\n// Serializes `object` and writes it to global `result`.\n// Returns true on success, or false on invalid object.\n//\nfunction writeNode(state, level, object, block, compact, iskey) {\n state.tag = null;\n state.dump = object;\n\n if (!detectType(state, object, false)) {\n detectType(state, object, true);\n }\n\n var type = _toString.call(state.dump);\n\n if (block) {\n block = (state.flowLevel < 0 || state.flowLevel > level);\n }\n\n var objectOrArray = type === '[object Object]' || type === '[object Array]',\n duplicateIndex,\n duplicate;\n\n if (objectOrArray) {\n duplicateIndex = state.duplicates.indexOf(object);\n duplicate = duplicateIndex !== -1;\n }\n\n if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {\n compact = false;\n }\n\n if (duplicate && state.usedDuplicates[duplicateIndex]) {\n state.dump = '*ref_' + duplicateIndex;\n } else {\n if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {\n state.usedDuplicates[duplicateIndex] = true;\n }\n if (type === '[object Object]') {\n if (block && (Object.keys(state.dump).length !== 0)) {\n writeBlockMapping(state, level, state.dump, compact);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowMapping(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if (type === '[object Array]') {\n if (block && (state.dump.length !== 0)) {\n writeBlockSequence(state, level, state.dump, compact);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowSequence(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if (type === '[object String]') {\n if (state.tag !== '?') {\n writeScalar(state, state.dump, level, iskey);\n }\n } else {\n if (state.skipInvalid) return false;\n throw new YAMLException('unacceptable kind of an object to dump ' + type);\n }\n\n if (state.tag !== null && state.tag !== '?') {\n state.dump = '!<' + state.tag + '> ' + state.dump;\n }\n }\n\n return true;\n}\n\nfunction getDuplicateReferences(object, state) {\n var objects = [],\n duplicatesIndexes = [],\n index,\n length;\n\n inspectNode(object, objects, duplicatesIndexes);\n\n for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {\n state.duplicates.push(objects[duplicatesIndexes[index]]);\n }\n state.usedDuplicates = new Array(length);\n}\n\nfunction inspectNode(object, objects, duplicatesIndexes) {\n var objectKeyList,\n index,\n length;\n\n if (object !== null && typeof object === 'object') {\n index = objects.indexOf(object);\n if (index !== -1) {\n if (duplicatesIndexes.indexOf(index) === -1) {\n duplicatesIndexes.push(index);\n }\n } else {\n objects.push(object);\n\n if (Array.isArray(object)) {\n for (index = 0, length = object.length; index < length; index += 1) {\n inspectNode(object[index], objects, duplicatesIndexes);\n }\n } else {\n objectKeyList = Object.keys(object);\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);\n }\n }\n }\n }\n}\n\nfunction dump(input, options) {\n options = options || {};\n\n var state = new State(options);\n\n if (!state.noRefs) getDuplicateReferences(input, state);\n\n if (writeNode(state, 0, input, true, true)) return state.dump + '\\n';\n\n return '';\n}\n\nfunction safeDump(input, options) {\n return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));\n}\n\nmodule.exports.dump = dump;\nmodule.exports.safeDump = safeDump;\n", - "// YAML error class. http://stackoverflow.com/questions/8458984\n//\n'use strict';\n\nfunction YAMLException(reason, mark) {\n // Super constructor\n Error.call(this);\n\n // Include stack trace in error object\n if (Error.captureStackTrace) {\n // Chrome and NodeJS\n Error.captureStackTrace(this, this.constructor);\n } else {\n // FF, IE 10+ and Safari 6+. Fallback for others\n this.stack = (new Error()).stack || '';\n }\n\n this.name = 'YAMLException';\n this.reason = reason;\n this.mark = mark;\n this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');\n}\n\n\n// Inherit from Error\nYAMLException.prototype = Object.create(Error.prototype);\nYAMLException.prototype.constructor = YAMLException;\n\n\nYAMLException.prototype.toString = function toString(compact) {\n var result = this.name + ': ';\n\n result += this.reason || '(unknown reason)';\n\n if (!compact && this.mark) {\n result += ' ' + this.mark.toString();\n }\n\n return result;\n};\n\n\nmodule.exports = YAMLException;\n", - "'use strict';\n\n/*eslint-disable max-len,no-use-before-define*/\n\nvar common = require('./common');\nvar YAMLException = require('./exception');\nvar Mark = require('./mark');\nvar DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');\nvar DEFAULT_FULL_SCHEMA = require('./schema/default_full');\n\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\n\nvar CONTEXT_FLOW_IN = 1;\nvar CONTEXT_FLOW_OUT = 2;\nvar CONTEXT_BLOCK_IN = 3;\nvar CONTEXT_BLOCK_OUT = 4;\n\n\nvar CHOMPING_CLIP = 1;\nvar CHOMPING_STRIP = 2;\nvar CHOMPING_KEEP = 3;\n\n\nvar PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/;\nvar PATTERN_NON_ASCII_LINE_BREAKS = /[\\x85\\u2028\\u2029]/;\nvar PATTERN_FLOW_INDICATORS = /[,\\[\\]\\{\\}]/;\nvar PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\\-]+!)$/i;\nvar PATTERN_TAG_URI = /^(?:!|[^,\\[\\]\\{\\}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;\\/\\?:@&=\\+\\$,_\\.!~\\*'\\(\\)\\[\\]])*$/i;\n\n\nfunction is_EOL(c) {\n return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);\n}\n\nfunction is_WHITE_SPACE(c) {\n return (c === 0x09/* Tab */) || (c === 0x20/* Space */);\n}\n\nfunction is_WS_OR_EOL(c) {\n return (c === 0x09/* Tab */) ||\n (c === 0x20/* Space */) ||\n (c === 0x0A/* LF */) ||\n (c === 0x0D/* CR */);\n}\n\nfunction is_FLOW_INDICATOR(c) {\n return c === 0x2C/* , */ ||\n c === 0x5B/* [ */ ||\n c === 0x5D/* ] */ ||\n c === 0x7B/* { */ ||\n c === 0x7D/* } */;\n}\n\nfunction fromHexCode(c) {\n var lc;\n\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n /*eslint-disable no-bitwise*/\n lc = c | 0x20;\n\n if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {\n return lc - 0x61 + 10;\n }\n\n return -1;\n}\n\nfunction escapedHexLen(c) {\n if (c === 0x78/* x */) { return 2; }\n if (c === 0x75/* u */) { return 4; }\n if (c === 0x55/* U */) { return 8; }\n return 0;\n}\n\nfunction fromDecimalCode(c) {\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n return -1;\n}\n\nfunction simpleEscapeSequence(c) {\n return (c === 0x30/* 0 */) ? '\\x00' :\n (c === 0x61/* a */) ? '\\x07' :\n (c === 0x62/* b */) ? '\\x08' :\n (c === 0x74/* t */) ? '\\x09' :\n (c === 0x09/* Tab */) ? '\\x09' :\n (c === 0x6E/* n */) ? '\\x0A' :\n (c === 0x76/* v */) ? '\\x0B' :\n (c === 0x66/* f */) ? '\\x0C' :\n (c === 0x72/* r */) ? '\\x0D' :\n (c === 0x65/* e */) ? '\\x1B' :\n (c === 0x20/* Space */) ? ' ' :\n (c === 0x22/* \" */) ? '\\x22' :\n (c === 0x2F/* / */) ? '/' :\n (c === 0x5C/* \\ */) ? '\\x5C' :\n (c === 0x4E/* N */) ? '\\x85' :\n (c === 0x5F/* _ */) ? '\\xA0' :\n (c === 0x4C/* L */) ? '\\u2028' :\n (c === 0x50/* P */) ? '\\u2029' : '';\n}\n\nfunction charFromCodepoint(c) {\n if (c <= 0xFFFF) {\n return String.fromCharCode(c);\n }\n // Encode UTF-16 surrogate pair\n // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF\n return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,\n ((c - 0x010000) & 0x03FF) + 0xDC00);\n}\n\nvar simpleEscapeCheck = new Array(256); // integer, for fast access\nvar simpleEscapeMap = new Array(256);\nfor (var i = 0; i < 256; i++) {\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;\n simpleEscapeMap[i] = simpleEscapeSequence(i);\n}\n\n\nfunction State(input, options) {\n this.input = input;\n\n this.filename = options['filename'] || null;\n this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;\n this.onWarning = options['onWarning'] || null;\n this.legacy = options['legacy'] || false;\n this.json = options['json'] || false;\n this.listener = options['listener'] || null;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.typeMap = this.schema.compiledTypeMap;\n\n this.length = input.length;\n this.position = 0;\n this.line = 0;\n this.lineStart = 0;\n this.lineIndent = 0;\n\n this.documents = [];\n\n /*\n this.version;\n this.checkLineBreaks;\n this.tagMap;\n this.anchorMap;\n this.tag;\n this.anchor;\n this.kind;\n this.result;*/\n\n}\n\n\nfunction generateError(state, message) {\n return new YAMLException(\n message,\n new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));\n}\n\nfunction throwError(state, message) {\n throw generateError(state, message);\n}\n\nfunction throwWarning(state, message) {\n if (state.onWarning) {\n state.onWarning.call(null, generateError(state, message));\n }\n}\n\n\nvar directiveHandlers = {\n\n YAML: function handleYamlDirective(state, name, args) {\n\n var match, major, minor;\n\n if (state.version !== null) {\n throwError(state, 'duplication of %YAML directive');\n }\n\n if (args.length !== 1) {\n throwError(state, 'YAML directive accepts exactly one argument');\n }\n\n match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0]);\n\n if (match === null) {\n throwError(state, 'ill-formed argument of the YAML directive');\n }\n\n major = parseInt(match[1], 10);\n minor = parseInt(match[2], 10);\n\n if (major !== 1) {\n throwError(state, 'unacceptable YAML version of the document');\n }\n\n state.version = args[0];\n state.checkLineBreaks = (minor < 2);\n\n if (minor !== 1 && minor !== 2) {\n throwWarning(state, 'unsupported YAML version of the document');\n }\n },\n\n TAG: function handleTagDirective(state, name, args) {\n\n var handle, prefix;\n\n if (args.length !== 2) {\n throwError(state, 'TAG directive accepts exactly two arguments');\n }\n\n handle = args[0];\n prefix = args[1];\n\n if (!PATTERN_TAG_HANDLE.test(handle)) {\n throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');\n }\n\n if (_hasOwnProperty.call(state.tagMap, handle)) {\n throwError(state, 'there is a previously declared suffix for \"' + handle + '\" tag handle');\n }\n\n if (!PATTERN_TAG_URI.test(prefix)) {\n throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');\n }\n\n state.tagMap[handle] = prefix;\n }\n};\n\n\nfunction captureSegment(state, start, end, checkJson) {\n var _position, _length, _character, _result;\n\n if (start < end) {\n _result = state.input.slice(start, end);\n\n if (checkJson) {\n for (_position = 0, _length = _result.length;\n _position < _length;\n _position += 1) {\n _character = _result.charCodeAt(_position);\n if (!(_character === 0x09 ||\n (0x20 <= _character && _character <= 0x10FFFF))) {\n throwError(state, 'expected valid JSON character');\n }\n }\n } else if (PATTERN_NON_PRINTABLE.test(_result)) {\n throwError(state, 'the stream contains non-printable characters');\n }\n\n state.result += _result;\n }\n}\n\nfunction mergeMappings(state, destination, source, overridableKeys) {\n var sourceKeys, key, index, quantity;\n\n if (!common.isObject(source)) {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable');\n }\n\n sourceKeys = Object.keys(source);\n\n for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {\n key = sourceKeys[index];\n\n if (!_hasOwnProperty.call(destination, key)) {\n destination[key] = source[key];\n overridableKeys[key] = true;\n }\n }\n}\n\nfunction storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) {\n var index, quantity;\n\n keyNode = String(keyNode);\n\n if (_result === null) {\n _result = {};\n }\n\n if (keyTag === 'tag:yaml.org,2002:merge') {\n if (Array.isArray(valueNode)) {\n for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {\n mergeMappings(state, _result, valueNode[index], overridableKeys);\n }\n } else {\n mergeMappings(state, _result, valueNode, overridableKeys);\n }\n } else {\n if (!state.json &&\n !_hasOwnProperty.call(overridableKeys, keyNode) &&\n _hasOwnProperty.call(_result, keyNode)) {\n throwError(state, 'duplicated mapping key');\n }\n _result[keyNode] = valueNode;\n delete overridableKeys[keyNode];\n }\n\n return _result;\n}\n\nfunction readLineBreak(state) {\n var ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x0A/* LF */) {\n state.position++;\n } else if (ch === 0x0D/* CR */) {\n state.position++;\n if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {\n state.position++;\n }\n } else {\n throwError(state, 'a line break is expected');\n }\n\n state.line += 1;\n state.lineStart = state.position;\n}\n\nfunction skipSeparationSpace(state, allowComments, checkIndent) {\n var lineBreaks = 0,\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (allowComments && ch === 0x23/* # */) {\n do {\n ch = state.input.charCodeAt(++state.position);\n } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);\n }\n\n if (is_EOL(ch)) {\n readLineBreak(state);\n\n ch = state.input.charCodeAt(state.position);\n lineBreaks++;\n state.lineIndent = 0;\n\n while (ch === 0x20/* Space */) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n } else {\n break;\n }\n }\n\n if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {\n throwWarning(state, 'deficient indentation');\n }\n\n return lineBreaks;\n}\n\nfunction testDocumentSeparator(state) {\n var _position = state.position,\n ch;\n\n ch = state.input.charCodeAt(_position);\n\n // Condition state.position === state.lineStart is tested\n // in parent on each call, for efficiency. No needs to test here again.\n if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\n ch === state.input.charCodeAt(_position + 1) &&\n ch === state.input.charCodeAt(_position + 2)) {\n\n _position += 3;\n\n ch = state.input.charCodeAt(_position);\n\n if (ch === 0 || is_WS_OR_EOL(ch)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction writeFoldedLines(state, count) {\n if (count === 1) {\n state.result += ' ';\n } else if (count > 1) {\n state.result += common.repeat('\\n', count - 1);\n }\n}\n\n\nfunction readPlainScalar(state, nodeIndent, withinFlowCollection) {\n var preceding,\n following,\n captureStart,\n captureEnd,\n hasPendingContent,\n _line,\n _lineStart,\n _lineIndent,\n _kind = state.kind,\n _result = state.result,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (is_WS_OR_EOL(ch) ||\n is_FLOW_INDICATOR(ch) ||\n ch === 0x23/* # */ ||\n ch === 0x26/* & */ ||\n ch === 0x2A/* * */ ||\n ch === 0x21/* ! */ ||\n ch === 0x7C/* | */ ||\n ch === 0x3E/* > */ ||\n ch === 0x27/* ' */ ||\n ch === 0x22/* \" */ ||\n ch === 0x25/* % */ ||\n ch === 0x40/* @ */ ||\n ch === 0x60/* ` */) {\n return false;\n }\n\n if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n return false;\n }\n }\n\n state.kind = 'scalar';\n state.result = '';\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n\n while (ch !== 0) {\n if (ch === 0x3A/* : */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n break;\n }\n\n } else if (ch === 0x23/* # */) {\n preceding = state.input.charCodeAt(state.position - 1);\n\n if (is_WS_OR_EOL(preceding)) {\n break;\n }\n\n } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||\n withinFlowCollection && is_FLOW_INDICATOR(ch)) {\n break;\n\n } else if (is_EOL(ch)) {\n _line = state.line;\n _lineStart = state.lineStart;\n _lineIndent = state.lineIndent;\n skipSeparationSpace(state, false, -1);\n\n if (state.lineIndent >= nodeIndent) {\n hasPendingContent = true;\n ch = state.input.charCodeAt(state.position);\n continue;\n } else {\n state.position = captureEnd;\n state.line = _line;\n state.lineStart = _lineStart;\n state.lineIndent = _lineIndent;\n break;\n }\n }\n\n if (hasPendingContent) {\n captureSegment(state, captureStart, captureEnd, false);\n writeFoldedLines(state, state.line - _line);\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n }\n\n if (!is_WHITE_SPACE(ch)) {\n captureEnd = state.position + 1;\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, captureEnd, false);\n\n if (state.result) {\n return true;\n }\n\n state.kind = _kind;\n state.result = _result;\n return false;\n}\n\nfunction readSingleQuotedScalar(state, nodeIndent) {\n var ch,\n captureStart, captureEnd;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x27/* ' */) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x27/* ' */) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x27/* ' */) {\n captureStart = captureEnd = state.position;\n state.position++;\n } else {\n return true;\n }\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a single quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a single quoted scalar');\n}\n\nfunction readDoubleQuotedScalar(state, nodeIndent) {\n var captureStart,\n captureEnd,\n hexLength,\n hexResult,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x22/* \" */) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x22/* \" */) {\n captureSegment(state, captureStart, state.position, true);\n state.position++;\n return true;\n\n } else if (ch === 0x5C/* \\ */) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (is_EOL(ch)) {\n skipSeparationSpace(state, false, nodeIndent);\n\n // TODO: rework to inline fn with no type cast?\n } else if (ch < 256 && simpleEscapeCheck[ch]) {\n state.result += simpleEscapeMap[ch];\n state.position++;\n\n } else if ((tmp = escapedHexLen(ch)) > 0) {\n hexLength = tmp;\n hexResult = 0;\n\n for (; hexLength > 0; hexLength--) {\n ch = state.input.charCodeAt(++state.position);\n\n if ((tmp = fromHexCode(ch)) >= 0) {\n hexResult = (hexResult << 4) + tmp;\n\n } else {\n throwError(state, 'expected hexadecimal character');\n }\n }\n\n state.result += charFromCodepoint(hexResult);\n\n state.position++;\n\n } else {\n throwError(state, 'unknown escape sequence');\n }\n\n captureStart = captureEnd = state.position;\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a double quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a double quoted scalar');\n}\n\nfunction readFlowCollection(state, nodeIndent) {\n var readNext = true,\n _line,\n _tag = state.tag,\n _result,\n _anchor = state.anchor,\n following,\n terminator,\n isPair,\n isExplicitPair,\n isMapping,\n overridableKeys = {},\n keyNode,\n keyTag,\n valueNode,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x5B/* [ */) {\n terminator = 0x5D;/* ] */\n isMapping = false;\n _result = [];\n } else if (ch === 0x7B/* { */) {\n terminator = 0x7D;/* } */\n isMapping = true;\n _result = {};\n } else {\n return false;\n }\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n while (ch !== 0) {\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === terminator) {\n state.position++;\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = isMapping ? 'mapping' : 'sequence';\n state.result = _result;\n return true;\n } else if (!readNext) {\n throwError(state, 'missed comma between flow collection entries');\n }\n\n keyTag = keyNode = valueNode = null;\n isPair = isExplicitPair = false;\n\n if (ch === 0x3F/* ? */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following)) {\n isPair = isExplicitPair = true;\n state.position++;\n skipSeparationSpace(state, true, nodeIndent);\n }\n }\n\n _line = state.line;\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n keyTag = state.tag;\n keyNode = state.result;\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {\n isPair = true;\n ch = state.input.charCodeAt(++state.position);\n skipSeparationSpace(state, true, nodeIndent);\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n valueNode = state.result;\n }\n\n if (isMapping) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);\n } else if (isPair) {\n _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));\n } else {\n _result.push(keyNode);\n }\n\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x2C/* , */) {\n readNext = true;\n ch = state.input.charCodeAt(++state.position);\n } else {\n readNext = false;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a flow collection');\n}\n\nfunction readBlockScalar(state, nodeIndent) {\n var captureStart,\n folding,\n chomping = CHOMPING_CLIP,\n detectedIndent = false,\n textIndent = nodeIndent,\n emptyLines = 0,\n atMoreIndented = false,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x7C/* | */) {\n folding = false;\n } else if (ch === 0x3E/* > */) {\n folding = true;\n } else {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n\n while (ch !== 0) {\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {\n if (CHOMPING_CLIP === chomping) {\n chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;\n } else {\n throwError(state, 'repeat of a chomping mode identifier');\n }\n\n } else if ((tmp = fromDecimalCode(ch)) >= 0) {\n if (tmp === 0) {\n throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');\n } else if (!detectedIndent) {\n textIndent = nodeIndent + tmp - 1;\n detectedIndent = true;\n } else {\n throwError(state, 'repeat of an indentation width identifier');\n }\n\n } else {\n break;\n }\n }\n\n if (is_WHITE_SPACE(ch)) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (is_WHITE_SPACE(ch));\n\n if (ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (!is_EOL(ch) && (ch !== 0));\n }\n }\n\n while (ch !== 0) {\n readLineBreak(state);\n state.lineIndent = 0;\n\n ch = state.input.charCodeAt(state.position);\n\n while ((!detectedIndent || state.lineIndent < textIndent) &&\n (ch === 0x20/* Space */)) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (!detectedIndent && state.lineIndent > textIndent) {\n textIndent = state.lineIndent;\n }\n\n if (is_EOL(ch)) {\n emptyLines++;\n continue;\n }\n\n // End of the scalar.\n if (state.lineIndent < textIndent) {\n\n // Perform the chomping.\n if (chomping === CHOMPING_KEEP) {\n state.result += common.repeat('\\n', emptyLines);\n } else if (chomping === CHOMPING_CLIP) {\n if (detectedIndent) { // i.e. only if the scalar is not empty.\n state.result += '\\n';\n }\n }\n\n // Break this `while` cycle and go to the funciton's epilogue.\n break;\n }\n\n // Folded style: use fancy rules to handle line breaks.\n if (folding) {\n\n // Lines starting with white space characters (more-indented lines) are not folded.\n if (is_WHITE_SPACE(ch)) {\n atMoreIndented = true;\n state.result += common.repeat('\\n', emptyLines + 1);\n\n // End of more-indented block.\n } else if (atMoreIndented) {\n atMoreIndented = false;\n state.result += common.repeat('\\n', emptyLines + 1);\n\n // Just one line break - perceive as the same line.\n } else if (emptyLines === 0) {\n if (detectedIndent) { // i.e. only if we have already read some scalar content.\n state.result += ' ';\n }\n\n // Several line breaks - perceive as different lines.\n } else {\n state.result += common.repeat('\\n', emptyLines);\n }\n\n // Literal style: just add exact number of line breaks between content lines.\n } else if (detectedIndent) {\n // If current line isn't the first one - count line break from the last content line.\n state.result += common.repeat('\\n', emptyLines + 1);\n } else {\n // In case of the first content line - count only empty lines.\n state.result += common.repeat('\\n', emptyLines);\n }\n\n detectedIndent = true;\n emptyLines = 0;\n captureStart = state.position;\n\n while (!is_EOL(ch) && (ch !== 0)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, state.position, false);\n }\n\n return true;\n}\n\nfunction readBlockSequence(state, nodeIndent) {\n var _line,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = [],\n following,\n detected = false,\n ch;\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n\n if (ch !== 0x2D/* - */) {\n break;\n }\n\n following = state.input.charCodeAt(state.position + 1);\n\n if (!is_WS_OR_EOL(following)) {\n break;\n }\n\n detected = true;\n state.position++;\n\n if (skipSeparationSpace(state, true, -1)) {\n if (state.lineIndent <= nodeIndent) {\n _result.push(null);\n ch = state.input.charCodeAt(state.position);\n continue;\n }\n }\n\n _line = state.line;\n composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);\n _result.push(state.result);\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\n throwError(state, 'bad indentation of a sequence entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'sequence';\n state.result = _result;\n return true;\n }\n return false;\n}\n\nfunction readBlockMapping(state, nodeIndent, flowIndent) {\n var following,\n allowCompact,\n _line,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = {},\n overridableKeys = {},\n keyTag = null,\n keyNode = null,\n valueNode = null,\n atExplicitKey = false,\n detected = false,\n ch;\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n following = state.input.charCodeAt(state.position + 1);\n _line = state.line; // Save the current line.\n\n //\n // Explicit notation case. There are two separate blocks:\n // first for the key (denoted by \"?\") and second for the value (denoted by \":\")\n //\n if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {\n\n if (ch === 0x3F/* ? */) {\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = true;\n allowCompact = true;\n\n } else if (atExplicitKey) {\n // i.e. 0x3A/* : */ === character after the explicit key.\n atExplicitKey = false;\n allowCompact = true;\n\n } else {\n throwError(state, 'incomplete explicit mapping pair; a key node is missed');\n }\n\n state.position += 1;\n ch = following;\n\n //\n // Implicit notation case. Flow-style node as the key first, then \":\", and the value.\n //\n } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\n\n if (state.line === _line) {\n ch = state.input.charCodeAt(state.position);\n\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (ch === 0x3A/* : */) {\n ch = state.input.charCodeAt(++state.position);\n\n if (!is_WS_OR_EOL(ch)) {\n throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');\n }\n\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = false;\n allowCompact = false;\n keyTag = state.tag;\n keyNode = state.result;\n\n } else if (detected) {\n throwError(state, 'can not read an implicit mapping pair; a colon is missed');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n\n } else if (detected) {\n throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n\n } else {\n break; // Reading is done. Go to the epilogue.\n }\n\n //\n // Common reading code for both explicit and implicit notations.\n //\n if (state.line === _line || state.lineIndent > nodeIndent) {\n if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {\n if (atExplicitKey) {\n keyNode = state.result;\n } else {\n valueNode = state.result;\n }\n }\n\n if (!atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);\n keyTag = keyNode = valueNode = null;\n }\n\n skipSeparationSpace(state, true, -1);\n ch = state.input.charCodeAt(state.position);\n }\n\n if (state.lineIndent > nodeIndent && (ch !== 0)) {\n throwError(state, 'bad indentation of a mapping entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n //\n // Epilogue.\n //\n\n // Special case: last mapping's node contains only the key in explicit notation.\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);\n }\n\n // Expose the resulting mapping.\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'mapping';\n state.result = _result;\n }\n\n return detected;\n}\n\nfunction readTagProperty(state) {\n var _position,\n isVerbatim = false,\n isNamed = false,\n tagHandle,\n tagName,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x21/* ! */) return false;\n\n if (state.tag !== null) {\n throwError(state, 'duplication of a tag property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x3C/* < */) {\n isVerbatim = true;\n ch = state.input.charCodeAt(++state.position);\n\n } else if (ch === 0x21/* ! */) {\n isNamed = true;\n tagHandle = '!!';\n ch = state.input.charCodeAt(++state.position);\n\n } else {\n tagHandle = '!';\n }\n\n _position = state.position;\n\n if (isVerbatim) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (ch !== 0 && ch !== 0x3E/* > */);\n\n if (state.position < state.length) {\n tagName = state.input.slice(_position, state.position);\n ch = state.input.charCodeAt(++state.position);\n } else {\n throwError(state, 'unexpected end of the stream within a verbatim tag');\n }\n } else {\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n\n if (ch === 0x21/* ! */) {\n if (!isNamed) {\n tagHandle = state.input.slice(_position - 1, state.position + 1);\n\n if (!PATTERN_TAG_HANDLE.test(tagHandle)) {\n throwError(state, 'named tag handle cannot contain such characters');\n }\n\n isNamed = true;\n _position = state.position + 1;\n } else {\n throwError(state, 'tag suffix cannot contain exclamation marks');\n }\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n tagName = state.input.slice(_position, state.position);\n\n if (PATTERN_FLOW_INDICATORS.test(tagName)) {\n throwError(state, 'tag suffix cannot contain flow indicator characters');\n }\n }\n\n if (tagName && !PATTERN_TAG_URI.test(tagName)) {\n throwError(state, 'tag name cannot contain such characters: ' + tagName);\n }\n\n if (isVerbatim) {\n state.tag = tagName;\n\n } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {\n state.tag = state.tagMap[tagHandle] + tagName;\n\n } else if (tagHandle === '!') {\n state.tag = '!' + tagName;\n\n } else if (tagHandle === '!!') {\n state.tag = 'tag:yaml.org,2002:' + tagName;\n\n } else {\n throwError(state, 'undeclared tag handle \"' + tagHandle + '\"');\n }\n\n return true;\n}\n\nfunction readAnchorProperty(state) {\n var _position,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x26/* & */) return false;\n\n if (state.anchor !== null) {\n throwError(state, 'duplication of an anchor property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an anchor node must contain at least one character');\n }\n\n state.anchor = state.input.slice(_position, state.position);\n return true;\n}\n\nfunction readAlias(state) {\n var _position, alias,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x2A/* * */) return false;\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an alias node must contain at least one character');\n }\n\n alias = state.input.slice(_position, state.position);\n\n if (!state.anchorMap.hasOwnProperty(alias)) {\n throwError(state, 'unidentified alias \"' + alias + '\"');\n }\n\n state.result = state.anchorMap[alias];\n skipSeparationSpace(state, true, -1);\n return true;\n}\n\nfunction composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {\n var allowBlockStyles,\n allowBlockScalars,\n allowBlockCollections,\n indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n }\n }\n\n if (indentStatus === 1) {\n while (readTagProperty(state) || readAnchorProperty(state)) {\n if (skipSeparationSpace(state, true, -1)) {\n atNewLine = true;\n allowBlockCollections = allowBlockStyles;\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n } else {\n allowBlockCollections = false;\n }\n }\n }\n\n if (allowBlockCollections) {\n allowBlockCollections = atNewLine || allowCompact;\n }\n\n if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {\n if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {\n flowIndent = parentIndent;\n } else {\n flowIndent = parentIndent + 1;\n }\n\n blockIndent = state.position - state.lineStart;\n\n if (indentStatus === 1) {\n if (allowBlockCollections &&\n (readBlockSequence(state, blockIndent) ||\n readBlockMapping(state, blockIndent, flowIndent)) ||\n readFlowCollection(state, flowIndent)) {\n hasContent = true;\n } else {\n if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||\n readSingleQuotedScalar(state, flowIndent) ||\n readDoubleQuotedScalar(state, flowIndent)) {\n hasContent = true;\n\n } else if (readAlias(state)) {\n hasContent = true;\n\n if (state.tag !== null || state.anchor !== null) {\n throwError(state, 'alias node should not have any properties');\n }\n\n } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {\n hasContent = true;\n\n if (state.tag === null) {\n state.tag = '?';\n }\n }\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n } else if (indentStatus === 0) {\n // Special case: block sequences are allowed to have same indentation level as the parent.\n // http://www.yaml.org/spec/1.2/spec.html#id2799784\n hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);\n }\n }\n\n if (state.tag !== null && state.tag !== '!') {\n if (state.tag === '?') {\n for (typeIndex = 0, typeQuantity = state.implicitTypes.length;\n typeIndex < typeQuantity;\n typeIndex += 1) {\n type = state.implicitTypes[typeIndex];\n\n // Implicit resolving is not allowed for non-scalar types, and '?'\n // non-specific tag is only assigned to plain scalars. So, it isn't\n // needed to check for 'kind' conformity.\n\n if (type.resolve(state.result)) { // `state.result` updated in resolver if matched\n state.result = type.construct(state.result);\n state.tag = type.tag;\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n break;\n }\n }\n } else if (_hasOwnProperty.call(state.typeMap, state.tag)) {\n type = state.typeMap[state.tag];\n\n if (state.result !== null && type.kind !== state.kind) {\n throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be \"' + type.kind + '\", not \"' + state.kind + '\"');\n }\n\n if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched\n throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');\n } else {\n state.result = type.construct(state.result);\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n } else {\n throwError(state, 'unknown tag !<' + state.tag + '>');\n }\n }\n\n if (state.listener !== null) {\n state.listener('close', state);\n }\n return state.tag !== null || state.anchor !== null || hasContent;\n}\n\nfunction readDocument(state) {\n var documentStart = state.position,\n _position,\n directiveName,\n directiveArgs,\n hasDirectives = false,\n ch;\n\n state.version = null;\n state.checkLineBreaks = state.legacy;\n state.tagMap = {};\n state.anchorMap = {};\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if (state.lineIndent > 0 || ch !== 0x25/* % */) {\n break;\n }\n\n hasDirectives = true;\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveName = state.input.slice(_position, state.position);\n directiveArgs = [];\n\n if (directiveName.length < 1) {\n throwError(state, 'directive name must not be less than one character in length');\n }\n\n while (ch !== 0) {\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (ch !== 0 && !is_EOL(ch));\n break;\n }\n\n if (is_EOL(ch)) break;\n\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveArgs.push(state.input.slice(_position, state.position));\n }\n\n if (ch !== 0) readLineBreak(state);\n\n if (_hasOwnProperty.call(directiveHandlers, directiveName)) {\n directiveHandlers[directiveName](state, directiveName, directiveArgs);\n } else {\n throwWarning(state, 'unknown document directive \"' + directiveName + '\"');\n }\n }\n\n skipSeparationSpace(state, true, -1);\n\n if (state.lineIndent === 0 &&\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n\n } else if (hasDirectives) {\n throwError(state, 'directives end mark is expected');\n }\n\n composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);\n skipSeparationSpace(state, true, -1);\n\n if (state.checkLineBreaks &&\n PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {\n throwWarning(state, 'non-ASCII line breaks are interpreted as content');\n }\n\n state.documents.push(state.result);\n\n if (state.position === state.lineStart && testDocumentSeparator(state)) {\n\n if (state.input.charCodeAt(state.position) === 0x2E/* . */) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n }\n return;\n }\n\n if (state.position < (state.length - 1)) {\n throwError(state, 'end of the stream or a document separator is expected');\n } else {\n return;\n }\n}\n\n\nfunction loadDocuments(input, options) {\n input = String(input);\n options = options || {};\n\n if (input.length !== 0) {\n\n // Add tailing `\\n` if not exists\n if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&\n input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {\n input += '\\n';\n }\n\n // Strip BOM\n if (input.charCodeAt(0) === 0xFEFF) {\n input = input.slice(1);\n }\n }\n\n var state = new State(input, options);\n\n // Use 0 as string terminator. That significantly simplifies bounds check.\n state.input += '\\0';\n\n while (state.input.charCodeAt(state.position) === 0x20/* Space */) {\n state.lineIndent += 1;\n state.position += 1;\n }\n\n while (state.position < (state.length - 1)) {\n readDocument(state);\n }\n\n return state.documents;\n}\n\n\nfunction loadAll(input, iterator, options) {\n var documents = loadDocuments(input, options), index, length;\n\n for (index = 0, length = documents.length; index < length; index += 1) {\n iterator(documents[index]);\n }\n}\n\n\nfunction load(input, options) {\n var documents = loadDocuments(input, options);\n\n if (documents.length === 0) {\n /*eslint-disable no-undefined*/\n return undefined;\n } else if (documents.length === 1) {\n return documents[0];\n }\n throw new YAMLException('expected a single document in the stream, but found more');\n}\n\n\nfunction safeLoadAll(input, output, options) {\n loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));\n}\n\n\nfunction safeLoad(input, options) {\n return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));\n}\n\n\nmodule.exports.loadAll = loadAll;\nmodule.exports.load = load;\nmodule.exports.safeLoadAll = safeLoadAll;\nmodule.exports.safeLoad = safeLoad;\n", - "'use strict';\n\n\nvar common = require('./common');\n\n\nfunction Mark(name, buffer, position, line, column) {\n this.name = name;\n this.buffer = buffer;\n this.position = position;\n this.line = line;\n this.column = column;\n}\n\n\nMark.prototype.getSnippet = function getSnippet(indent, maxLength) {\n var head, start, tail, end, snippet;\n\n if (!this.buffer) return null;\n\n indent = indent || 4;\n maxLength = maxLength || 75;\n\n head = '';\n start = this.position;\n\n while (start > 0 && '\\x00\\r\\n\\x85\\u2028\\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {\n start -= 1;\n if (this.position - start > (maxLength / 2 - 1)) {\n head = ' ... ';\n start += 5;\n break;\n }\n }\n\n tail = '';\n end = this.position;\n\n while (end < this.buffer.length && '\\x00\\r\\n\\x85\\u2028\\u2029'.indexOf(this.buffer.charAt(end)) === -1) {\n end += 1;\n if (end - this.position > (maxLength / 2 - 1)) {\n tail = ' ... ';\n end -= 5;\n break;\n }\n }\n\n snippet = this.buffer.slice(start, end);\n\n return common.repeat(' ', indent) + head + snippet + tail + '\\n' +\n common.repeat(' ', indent + this.position - start + head.length) + '^';\n};\n\n\nMark.prototype.toString = function toString(compact) {\n var snippet, where = '';\n\n if (this.name) {\n where += 'in \"' + this.name + '\" ';\n }\n\n where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);\n\n if (!compact) {\n snippet = this.getSnippet();\n\n if (snippet) {\n where += ':\\n' + snippet;\n }\n }\n\n return where;\n};\n\n\nmodule.exports = Mark;\n", - "'use strict';\n\n/*eslint-disable max-len*/\n\nvar common = require('./common');\nvar YAMLException = require('./exception');\nvar Type = require('./type');\n\n\nfunction compileList(schema, name, result) {\n var exclude = [];\n\n schema.include.forEach(function (includedSchema) {\n result = compileList(includedSchema, name, result);\n });\n\n schema[name].forEach(function (currentType) {\n result.forEach(function (previousType, previousIndex) {\n if (previousType.tag === currentType.tag) {\n exclude.push(previousIndex);\n }\n });\n\n result.push(currentType);\n });\n\n return result.filter(function (type, index) {\n return exclude.indexOf(index) === -1;\n });\n}\n\n\nfunction compileMap(/* lists... */) {\n var result = {}, index, length;\n\n function collectType(type) {\n result[type.tag] = type;\n }\n\n for (index = 0, length = arguments.length; index < length; index += 1) {\n arguments[index].forEach(collectType);\n }\n\n return result;\n}\n\n\nfunction Schema(definition) {\n this.include = definition.include || [];\n this.implicit = definition.implicit || [];\n this.explicit = definition.explicit || [];\n\n this.implicit.forEach(function (type) {\n if (type.loadKind && type.loadKind !== 'scalar') {\n throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');\n }\n });\n\n this.compiledImplicit = compileList(this, 'implicit', []);\n this.compiledExplicit = compileList(this, 'explicit', []);\n this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);\n}\n\n\nSchema.DEFAULT = null;\n\n\nSchema.create = function createSchema() {\n var schemas, types;\n\n switch (arguments.length) {\n case 1:\n schemas = Schema.DEFAULT;\n types = arguments[0];\n break;\n\n case 2:\n schemas = arguments[0];\n types = arguments[1];\n break;\n\n default:\n throw new YAMLException('Wrong number of arguments for Schema.create function');\n }\n\n schemas = common.toArray(schemas);\n types = common.toArray(types);\n\n if (!schemas.every(function (schema) { return schema instanceof Schema; })) {\n throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');\n }\n\n if (!types.every(function (type) { return type instanceof Type; })) {\n throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');\n }\n\n return new Schema({\n include: schemas,\n explicit: types\n });\n};\n\n\nmodule.exports = Schema;\n", + "'use strict';\n\n\nfunction isNothing(subject) {\n return (typeof subject === 'undefined') || (null === subject);\n}\n\n\nfunction isObject(subject) {\n return (typeof subject === 'object') && (null !== subject);\n}\n\n\nfunction toArray(sequence) {\n if (Array.isArray(sequence)) {\n return sequence;\n } else if (isNothing(sequence)) {\n return [];\n }\n return [ sequence ];\n}\n\n\nfunction extend(target, source) {\n var index, length, key, sourceKeys;\n\n if (source) {\n sourceKeys = Object.keys(source);\n\n for (index = 0, length = sourceKeys.length; index < length; index += 1) {\n key = sourceKeys[index];\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n\nfunction repeat(string, count) {\n var result = '', cycle;\n\n for (cycle = 0; cycle < count; cycle += 1) {\n result += string;\n }\n\n return result;\n}\n\n\nfunction isNegativeZero(number) {\n return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);\n}\n\n\nmodule.exports.isNothing = isNothing;\nmodule.exports.isObject = isObject;\nmodule.exports.toArray = toArray;\nmodule.exports.repeat = repeat;\nmodule.exports.isNegativeZero = isNegativeZero;\nmodule.exports.extend = extend;\n", + "'use strict';\n\n/*eslint-disable no-use-before-define*/\n\nvar common = require('./common');\nvar YAMLException = require('./exception');\nvar DEFAULT_FULL_SCHEMA = require('./schema/default_full');\nvar DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');\n\nvar _toString = Object.prototype.toString;\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar CHAR_TAB = 0x09; /* Tab */\nvar CHAR_LINE_FEED = 0x0A; /* LF */\nvar CHAR_CARRIAGE_RETURN = 0x0D; /* CR */\nvar CHAR_SPACE = 0x20; /* Space */\nvar CHAR_EXCLAMATION = 0x21; /* ! */\nvar CHAR_DOUBLE_QUOTE = 0x22; /* \" */\nvar CHAR_SHARP = 0x23; /* # */\nvar CHAR_PERCENT = 0x25; /* % */\nvar CHAR_AMPERSAND = 0x26; /* & */\nvar CHAR_SINGLE_QUOTE = 0x27; /* ' */\nvar CHAR_ASTERISK = 0x2A; /* * */\nvar CHAR_COMMA = 0x2C; /* , */\nvar CHAR_MINUS = 0x2D; /* - */\nvar CHAR_COLON = 0x3A; /* : */\nvar CHAR_GREATER_THAN = 0x3E; /* > */\nvar CHAR_QUESTION = 0x3F; /* ? */\nvar CHAR_COMMERCIAL_AT = 0x40; /* @ */\nvar CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */\nvar CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */\nvar CHAR_GRAVE_ACCENT = 0x60; /* ` */\nvar CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */\nvar CHAR_VERTICAL_LINE = 0x7C; /* | */\nvar CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */\n\nvar ESCAPE_SEQUENCES = {};\n\nESCAPE_SEQUENCES[0x00] = '\\\\0';\nESCAPE_SEQUENCES[0x07] = '\\\\a';\nESCAPE_SEQUENCES[0x08] = '\\\\b';\nESCAPE_SEQUENCES[0x09] = '\\\\t';\nESCAPE_SEQUENCES[0x0A] = '\\\\n';\nESCAPE_SEQUENCES[0x0B] = '\\\\v';\nESCAPE_SEQUENCES[0x0C] = '\\\\f';\nESCAPE_SEQUENCES[0x0D] = '\\\\r';\nESCAPE_SEQUENCES[0x1B] = '\\\\e';\nESCAPE_SEQUENCES[0x22] = '\\\\\"';\nESCAPE_SEQUENCES[0x5C] = '\\\\\\\\';\nESCAPE_SEQUENCES[0x85] = '\\\\N';\nESCAPE_SEQUENCES[0xA0] = '\\\\_';\nESCAPE_SEQUENCES[0x2028] = '\\\\L';\nESCAPE_SEQUENCES[0x2029] = '\\\\P';\n\nvar DEPRECATED_BOOLEANS_SYNTAX = [\n 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',\n 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'\n];\n\nfunction compileStyleMap(schema, map) {\n var result, keys, index, length, tag, style, type;\n\n if (null === map) {\n return {};\n }\n\n result = {};\n keys = Object.keys(map);\n\n for (index = 0, length = keys.length; index < length; index += 1) {\n tag = keys[index];\n style = String(map[tag]);\n\n if ('!!' === tag.slice(0, 2)) {\n tag = 'tag:yaml.org,2002:' + tag.slice(2);\n }\n\n type = schema.compiledTypeMap[tag];\n\n if (type && _hasOwnProperty.call(type.styleAliases, style)) {\n style = type.styleAliases[style];\n }\n\n result[tag] = style;\n }\n\n return result;\n}\n\nfunction encodeHex(character) {\n var string, handle, length;\n\n string = character.toString(16).toUpperCase();\n\n if (character <= 0xFF) {\n handle = 'x';\n length = 2;\n } else if (character <= 0xFFFF) {\n handle = 'u';\n length = 4;\n } else if (character <= 0xFFFFFFFF) {\n handle = 'U';\n length = 8;\n } else {\n throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');\n }\n\n return '\\\\' + handle + common.repeat('0', length - string.length) + string;\n}\n\nfunction State(options) {\n this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;\n this.indent = Math.max(1, (options['indent'] || 2));\n this.skipInvalid = options['skipInvalid'] || false;\n this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);\n this.styleMap = compileStyleMap(this.schema, options['styles'] || null);\n this.sortKeys = options['sortKeys'] || false;\n this.lineWidth = options['lineWidth'] || 80;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.explicitTypes = this.schema.compiledExplicit;\n\n this.tag = null;\n this.result = '';\n\n this.duplicates = [];\n this.usedDuplicates = null;\n}\n\nfunction indentString(string, spaces) {\n var ind = common.repeat(' ', spaces),\n position = 0,\n next = -1,\n result = '',\n line,\n length = string.length;\n\n while (position < length) {\n next = string.indexOf('\\n', position);\n if (next === -1) {\n line = string.slice(position);\n position = length;\n } else {\n line = string.slice(position, next + 1);\n position = next + 1;\n }\n if (line.length && line !== '\\n') {\n result += ind;\n }\n result += line;\n }\n\n return result;\n}\n\nfunction generateNextLine(state, level) {\n return '\\n' + common.repeat(' ', state.indent * level);\n}\n\nfunction testImplicitResolving(state, str) {\n var index, length, type;\n\n for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {\n type = state.implicitTypes[index];\n\n if (type.resolve(str)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction StringBuilder(source) {\n this.source = source;\n this.result = '';\n this.checkpoint = 0;\n}\n\nStringBuilder.prototype.takeUpTo = function (position) {\n var er;\n\n if (position < this.checkpoint) {\n er = new Error('position should be > checkpoint');\n er.position = position;\n er.checkpoint = this.checkpoint;\n throw er;\n }\n\n this.result += this.source.slice(this.checkpoint, position);\n this.checkpoint = position;\n return this;\n};\n\nStringBuilder.prototype.escapeChar = function () {\n var character, esc;\n\n character = this.source.charCodeAt(this.checkpoint);\n esc = ESCAPE_SEQUENCES[character] || encodeHex(character);\n this.result += esc;\n this.checkpoint += 1;\n\n return this;\n};\n\nStringBuilder.prototype.finish = function () {\n if (this.source.length > this.checkpoint) {\n this.takeUpTo(this.source.length);\n }\n};\n\nfunction writeScalar(state, object, level, iskey) {\n var simple, first, spaceWrap, folded, literal, single, double,\n sawLineFeed, linePosition, longestLine, indent, max, character,\n position, escapeSeq, hexEsc, previous, lineLength, modifier,\n trailingLineBreaks, result;\n\n if (0 === object.length) {\n state.dump = \"''\";\n return;\n }\n\n if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {\n state.dump = \"'\" + object + \"'\";\n return;\n }\n\n simple = true;\n first = object.length ? object.charCodeAt(0) : 0;\n spaceWrap = (CHAR_SPACE === first ||\n CHAR_SPACE === object.charCodeAt(object.length - 1));\n\n // Simplified check for restricted first characters\n // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29\n if (CHAR_MINUS === first ||\n CHAR_QUESTION === first ||\n CHAR_COMMERCIAL_AT === first ||\n CHAR_GRAVE_ACCENT === first) {\n simple = false;\n }\n\n // can only use > and | if not wrapped in spaces or is not a key.\n if (spaceWrap) {\n simple = false;\n folded = false;\n literal = false;\n } else {\n folded = !iskey;\n literal = !iskey;\n }\n\n single = true;\n double = new StringBuilder(object);\n\n sawLineFeed = false;\n linePosition = 0;\n longestLine = 0;\n\n indent = state.indent * level;\n max = state.lineWidth;\n if (max === -1) {\n // Replace -1 with biggest ingeger number according to\n // http://ecma262-5.com/ELS5_HTML.htm#Section_8.5\n max = 9007199254740991;\n }\n\n if (indent < 40) {\n max -= indent;\n } else {\n max = 40;\n }\n\n for (position = 0; position < object.length; position++) {\n character = object.charCodeAt(position);\n if (simple) {\n // Characters that can never appear in the simple scalar\n if (!simpleChar(character)) {\n simple = false;\n } else {\n // Still simple. If we make it all the way through like\n // this, then we can just dump the string as-is.\n continue;\n }\n }\n\n if (single && character === CHAR_SINGLE_QUOTE) {\n single = false;\n }\n\n escapeSeq = ESCAPE_SEQUENCES[character];\n hexEsc = needsHexEscape(character);\n\n if (!escapeSeq && !hexEsc) {\n continue;\n }\n\n if (character !== CHAR_LINE_FEED &&\n character !== CHAR_DOUBLE_QUOTE &&\n character !== CHAR_SINGLE_QUOTE) {\n folded = false;\n literal = false;\n } else if (character === CHAR_LINE_FEED) {\n sawLineFeed = true;\n single = false;\n if (position > 0) {\n previous = object.charCodeAt(position - 1);\n if (previous === CHAR_SPACE) {\n literal = false;\n folded = false;\n }\n }\n if (folded) {\n lineLength = position - linePosition;\n linePosition = position;\n if (lineLength > longestLine) {\n longestLine = lineLength;\n }\n }\n }\n\n if (character !== CHAR_DOUBLE_QUOTE) {\n single = false;\n }\n\n double.takeUpTo(position);\n double.escapeChar();\n }\n\n if (simple && testImplicitResolving(state, object)) {\n simple = false;\n }\n\n modifier = '';\n if (folded || literal) {\n trailingLineBreaks = 0;\n if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) {\n trailingLineBreaks += 1;\n if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) {\n trailingLineBreaks += 1;\n }\n }\n\n if (trailingLineBreaks === 0) {\n modifier = '-';\n } else if (trailingLineBreaks === 2) {\n modifier = '+';\n }\n }\n\n if (literal && longestLine < max) {\n folded = false;\n }\n\n // If it's literally one line, then don't bother with the literal.\n // We may still want to do a fold, though, if it's a super long line.\n if (!sawLineFeed) {\n literal = false;\n }\n\n if (simple) {\n state.dump = object;\n } else if (single) {\n state.dump = '\\'' + object + '\\'';\n } else if (folded) {\n result = fold(object, max);\n state.dump = '>' + modifier + '\\n' + indentString(result, indent);\n } else if (literal) {\n if (!modifier) {\n object = object.replace(/\\n$/, '');\n }\n state.dump = '|' + modifier + '\\n' + indentString(object, indent);\n } else if (double) {\n double.finish();\n state.dump = '\"' + double.result + '\"';\n } else {\n throw new Error('Failed to dump scalar value');\n }\n\n return;\n}\n\n// The `trailing` var is a regexp match of any trailing `\\n` characters.\n//\n// There are three cases we care about:\n//\n// 1. One trailing `\\n` on the string. Just use `|` or `>`.\n// This is the assumed default. (trailing = null)\n// 2. No trailing `\\n` on the string. Use `|-` or `>-` to \"chomp\" the end.\n// 3. More than one trailing `\\n` on the string. Use `|+` or `>+`.\n//\n// In the case of `>+`, these line breaks are *not* doubled (like the line\n// breaks within the string), so it's important to only end with the exact\n// same number as we started.\nfunction fold(object, max) {\n var result = '',\n position = 0,\n length = object.length,\n trailing = /\\n+$/.exec(object),\n newLine;\n\n if (trailing) {\n length = trailing.index + 1;\n }\n\n while (position < length) {\n newLine = object.indexOf('\\n', position);\n if (newLine > length || newLine === -1) {\n if (result) {\n result += '\\n\\n';\n }\n result += foldLine(object.slice(position, length), max);\n position = length;\n } else {\n if (result) {\n result += '\\n\\n';\n }\n result += foldLine(object.slice(position, newLine), max);\n position = newLine + 1;\n }\n }\n if (trailing && trailing[0] !== '\\n') {\n result += trailing[0];\n }\n\n return result;\n}\n\nfunction foldLine(line, max) {\n if (line === '') {\n return line;\n }\n\n var foldRe = /[^\\s] [^\\s]/g,\n result = '',\n prevMatch = 0,\n foldStart = 0,\n match = foldRe.exec(line),\n index,\n foldEnd,\n folded;\n\n while (match) {\n index = match.index;\n\n // when we cross the max len, if the previous match would've\n // been ok, use that one, and carry on. If there was no previous\n // match on this fold section, then just have a long line.\n if (index - foldStart > max) {\n if (prevMatch !== foldStart) {\n foldEnd = prevMatch;\n } else {\n foldEnd = index;\n }\n\n if (result) {\n result += '\\n';\n }\n folded = line.slice(foldStart, foldEnd);\n result += folded;\n foldStart = foldEnd + 1;\n }\n prevMatch = index + 1;\n match = foldRe.exec(line);\n }\n\n if (result) {\n result += '\\n';\n }\n\n // if we end up with one last word at the end, then the last bit might\n // be slightly bigger than we wanted, because we exited out of the loop.\n if (foldStart !== prevMatch && line.length - foldStart > max) {\n result += line.slice(foldStart, prevMatch) + '\\n' +\n line.slice(prevMatch + 1);\n } else {\n result += line.slice(foldStart);\n }\n\n return result;\n}\n\n// Returns true if character can be found in a simple scalar\nfunction simpleChar(character) {\n return CHAR_TAB !== character &&\n CHAR_LINE_FEED !== character &&\n CHAR_CARRIAGE_RETURN !== character &&\n CHAR_COMMA !== character &&\n CHAR_LEFT_SQUARE_BRACKET !== character &&\n CHAR_RIGHT_SQUARE_BRACKET !== character &&\n CHAR_LEFT_CURLY_BRACKET !== character &&\n CHAR_RIGHT_CURLY_BRACKET !== character &&\n CHAR_SHARP !== character &&\n CHAR_AMPERSAND !== character &&\n CHAR_ASTERISK !== character &&\n CHAR_EXCLAMATION !== character &&\n CHAR_VERTICAL_LINE !== character &&\n CHAR_GREATER_THAN !== character &&\n CHAR_SINGLE_QUOTE !== character &&\n CHAR_DOUBLE_QUOTE !== character &&\n CHAR_PERCENT !== character &&\n CHAR_COLON !== character &&\n !ESCAPE_SEQUENCES[character] &&\n !needsHexEscape(character);\n}\n\n// Returns true if the character code needs to be escaped.\nfunction needsHexEscape(character) {\n return !((0x00020 <= character && character <= 0x00007E) ||\n (0x00085 === character) ||\n (0x000A0 <= character && character <= 0x00D7FF) ||\n (0x0E000 <= character && character <= 0x00FFFD) ||\n (0x10000 <= character && character <= 0x10FFFF));\n}\n\nfunction writeFlowSequence(state, level, object) {\n var _result = '',\n _tag = state.tag,\n index,\n length;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n // Write only valid elements.\n if (writeNode(state, level, object[index], false, false)) {\n if (0 !== index) {\n _result += ', ';\n }\n _result += state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = '[' + _result + ']';\n}\n\nfunction writeBlockSequence(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n index,\n length;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n // Write only valid elements.\n if (writeNode(state, level + 1, object[index], true, true)) {\n if (!compact || 0 !== index) {\n _result += generateNextLine(state, level);\n }\n _result += '- ' + state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = _result || '[]'; // Empty sequence if no valid values.\n}\n\nfunction writeFlowMapping(state, level, object) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n pairBuffer;\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n pairBuffer = '';\n\n if (0 !== index) {\n pairBuffer += ', ';\n }\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (!writeNode(state, level, objectKey, false, false)) {\n continue; // Skip this pair because of invalid key;\n }\n\n if (state.dump.length > 1024) {\n pairBuffer += '? ';\n }\n\n pairBuffer += state.dump + ': ';\n\n if (!writeNode(state, level, objectValue, false, false)) {\n continue; // Skip this pair because of invalid value.\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = '{' + _result + '}';\n}\n\nfunction writeBlockMapping(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n explicitPair,\n pairBuffer;\n\n // Allow sorting keys so that the output file is deterministic\n if (state.sortKeys === true) {\n // Default sorting\n objectKeyList.sort();\n } else if (typeof state.sortKeys === 'function') {\n // Custom sort function\n objectKeyList.sort(state.sortKeys);\n } else if (state.sortKeys) {\n // Something is wrong\n throw new YAMLException('sortKeys must be a boolean or a function');\n }\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n pairBuffer = '';\n\n if (!compact || 0 !== index) {\n pairBuffer += generateNextLine(state, level);\n }\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (!writeNode(state, level + 1, objectKey, true, true, true)) {\n continue; // Skip this pair because of invalid key.\n }\n\n explicitPair = (null !== state.tag && '?' !== state.tag) ||\n (state.dump && state.dump.length > 1024);\n\n if (explicitPair) {\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += '?';\n } else {\n pairBuffer += '? ';\n }\n }\n\n pairBuffer += state.dump;\n\n if (explicitPair) {\n pairBuffer += generateNextLine(state, level);\n }\n\n if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {\n continue; // Skip this pair because of invalid value.\n }\n\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += ':';\n } else {\n pairBuffer += ': ';\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = _result || '{}'; // Empty mapping if no valid pairs.\n}\n\nfunction detectType(state, object, explicit) {\n var _result, typeList, index, length, type, style;\n\n typeList = explicit ? state.explicitTypes : state.implicitTypes;\n\n for (index = 0, length = typeList.length; index < length; index += 1) {\n type = typeList[index];\n\n if ((type.instanceOf || type.predicate) &&\n (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&\n (!type.predicate || type.predicate(object))) {\n\n state.tag = explicit ? type.tag : '?';\n\n if (type.represent) {\n style = state.styleMap[type.tag] || type.defaultStyle;\n\n if ('[object Function]' === _toString.call(type.represent)) {\n _result = type.represent(object, style);\n } else if (_hasOwnProperty.call(type.represent, style)) {\n _result = type.represent[style](object, style);\n } else {\n throw new YAMLException('!<' + type.tag + '> tag resolver accepts not \"' + style + '\" style');\n }\n\n state.dump = _result;\n }\n\n return true;\n }\n }\n\n return false;\n}\n\n// Serializes `object` and writes it to global `result`.\n// Returns true on success, or false on invalid object.\n//\nfunction writeNode(state, level, object, block, compact, iskey) {\n state.tag = null;\n state.dump = object;\n\n if (!detectType(state, object, false)) {\n detectType(state, object, true);\n }\n\n var type = _toString.call(state.dump);\n\n if (block) {\n block = (0 > state.flowLevel || state.flowLevel > level);\n }\n\n var objectOrArray = '[object Object]' === type || '[object Array]' === type,\n duplicateIndex,\n duplicate;\n\n if (objectOrArray) {\n duplicateIndex = state.duplicates.indexOf(object);\n duplicate = duplicateIndex !== -1;\n }\n\n if ((null !== state.tag && '?' !== state.tag) || duplicate || (2 !== state.indent && level > 0)) {\n compact = false;\n }\n\n if (duplicate && state.usedDuplicates[duplicateIndex]) {\n state.dump = '*ref_' + duplicateIndex;\n } else {\n if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {\n state.usedDuplicates[duplicateIndex] = true;\n }\n if ('[object Object]' === type) {\n if (block && (0 !== Object.keys(state.dump).length)) {\n writeBlockMapping(state, level, state.dump, compact);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowMapping(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if ('[object Array]' === type) {\n if (block && (0 !== state.dump.length)) {\n writeBlockSequence(state, level, state.dump, compact);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowSequence(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if ('[object String]' === type) {\n if ('?' !== state.tag) {\n writeScalar(state, state.dump, level, iskey);\n }\n } else {\n if (state.skipInvalid) {\n return false;\n }\n throw new YAMLException('unacceptable kind of an object to dump ' + type);\n }\n\n if (null !== state.tag && '?' !== state.tag) {\n state.dump = '!<' + state.tag + '> ' + state.dump;\n }\n }\n\n return true;\n}\n\nfunction getDuplicateReferences(object, state) {\n var objects = [],\n duplicatesIndexes = [],\n index,\n length;\n\n inspectNode(object, objects, duplicatesIndexes);\n\n for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {\n state.duplicates.push(objects[duplicatesIndexes[index]]);\n }\n state.usedDuplicates = new Array(length);\n}\n\nfunction inspectNode(object, objects, duplicatesIndexes) {\n var objectKeyList,\n index,\n length;\n\n if (null !== object && 'object' === typeof object) {\n index = objects.indexOf(object);\n if (-1 !== index) {\n if (-1 === duplicatesIndexes.indexOf(index)) {\n duplicatesIndexes.push(index);\n }\n } else {\n objects.push(object);\n\n if (Array.isArray(object)) {\n for (index = 0, length = object.length; index < length; index += 1) {\n inspectNode(object[index], objects, duplicatesIndexes);\n }\n } else {\n objectKeyList = Object.keys(object);\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);\n }\n }\n }\n }\n}\n\nfunction dump(input, options) {\n options = options || {};\n\n var state = new State(options);\n\n getDuplicateReferences(input, state);\n\n if (writeNode(state, 0, input, true, true)) {\n return state.dump + '\\n';\n }\n return '';\n}\n\nfunction safeDump(input, options) {\n return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));\n}\n\nmodule.exports.dump = dump;\nmodule.exports.safeDump = safeDump;\n", + "// YAML error class. http://stackoverflow.com/questions/8458984\n//\n'use strict';\n\n\nvar inherits = require('inherit');\n\n\nfunction YAMLException(reason, mark) {\n // Super constructor\n Error.call(this);\n\n // Include stack trace in error object\n if (Error.captureStackTrace) {\n // Chrome and NodeJS\n Error.captureStackTrace(this, this.constructor);\n } else {\n // FF, IE 10+ and Safari 6+. Fallback for others\n this.stack = (new Error()).stack || '';\n }\n\n this.name = 'YAMLException';\n this.reason = reason;\n this.mark = mark;\n this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');\n}\n\n\n// Inherit from Error\ninherits(YAMLException, Error);\n\n\nYAMLException.prototype.toString = function toString(compact) {\n var result = this.name + ': ';\n\n result += this.reason || '(unknown reason)';\n\n if (!compact && this.mark) {\n result += ' ' + this.mark.toString();\n }\n\n return result;\n};\n\n\nmodule.exports = YAMLException;\n", + "'use strict';\n\n/*eslint-disable max-len,no-use-before-define*/\n\nvar common = require('./common');\nvar YAMLException = require('./exception');\nvar Mark = require('./mark');\nvar DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');\nvar DEFAULT_FULL_SCHEMA = require('./schema/default_full');\n\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\n\nvar CONTEXT_FLOW_IN = 1;\nvar CONTEXT_FLOW_OUT = 2;\nvar CONTEXT_BLOCK_IN = 3;\nvar CONTEXT_BLOCK_OUT = 4;\n\n\nvar CHOMPING_CLIP = 1;\nvar CHOMPING_STRIP = 2;\nvar CHOMPING_KEEP = 3;\n\n\nvar PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/;\nvar PATTERN_NON_ASCII_LINE_BREAKS = /[\\x85\\u2028\\u2029]/;\nvar PATTERN_FLOW_INDICATORS = /[,\\[\\]\\{\\}]/;\nvar PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\\-]+!)$/i;\nvar PATTERN_TAG_URI = /^(?:!|[^,\\[\\]\\{\\}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;\\/\\?:@&=\\+\\$,_\\.!~\\*'\\(\\)\\[\\]])*$/i;\n\n\nfunction is_EOL(c) {\n return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);\n}\n\nfunction is_WHITE_SPACE(c) {\n return (c === 0x09/* Tab */) || (c === 0x20/* Space */);\n}\n\nfunction is_WS_OR_EOL(c) {\n return (c === 0x09/* Tab */) ||\n (c === 0x20/* Space */) ||\n (c === 0x0A/* LF */) ||\n (c === 0x0D/* CR */);\n}\n\nfunction is_FLOW_INDICATOR(c) {\n return 0x2C/* , */ === c ||\n 0x5B/* [ */ === c ||\n 0x5D/* ] */ === c ||\n 0x7B/* { */ === c ||\n 0x7D/* } */ === c;\n}\n\nfunction fromHexCode(c) {\n var lc;\n\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n /*eslint-disable no-bitwise*/\n lc = c | 0x20;\n\n if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {\n return lc - 0x61 + 10;\n }\n\n return -1;\n}\n\nfunction escapedHexLen(c) {\n if (c === 0x78/* x */) { return 2; }\n if (c === 0x75/* u */) { return 4; }\n if (c === 0x55/* U */) { return 8; }\n return 0;\n}\n\nfunction fromDecimalCode(c) {\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n return -1;\n}\n\nfunction simpleEscapeSequence(c) {\n return (c === 0x30/* 0 */) ? '\\x00' :\n (c === 0x61/* a */) ? '\\x07' :\n (c === 0x62/* b */) ? '\\x08' :\n (c === 0x74/* t */) ? '\\x09' :\n (c === 0x09/* Tab */) ? '\\x09' :\n (c === 0x6E/* n */) ? '\\x0A' :\n (c === 0x76/* v */) ? '\\x0B' :\n (c === 0x66/* f */) ? '\\x0C' :\n (c === 0x72/* r */) ? '\\x0D' :\n (c === 0x65/* e */) ? '\\x1B' :\n (c === 0x20/* Space */) ? ' ' :\n (c === 0x22/* \" */) ? '\\x22' :\n (c === 0x2F/* / */) ? '/' :\n (c === 0x5C/* \\ */) ? '\\x5C' :\n (c === 0x4E/* N */) ? '\\x85' :\n (c === 0x5F/* _ */) ? '\\xA0' :\n (c === 0x4C/* L */) ? '\\u2028' :\n (c === 0x50/* P */) ? '\\u2029' : '';\n}\n\nfunction charFromCodepoint(c) {\n if (c <= 0xFFFF) {\n return String.fromCharCode(c);\n }\n // Encode UTF-16 surrogate pair\n // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF\n return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,\n ((c - 0x010000) & 0x03FF) + 0xDC00);\n}\n\nvar simpleEscapeCheck = new Array(256); // integer, for fast access\nvar simpleEscapeMap = new Array(256);\nfor (var i = 0; i < 256; i++) {\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;\n simpleEscapeMap[i] = simpleEscapeSequence(i);\n}\n\n\nfunction State(input, options) {\n this.input = input;\n\n this.filename = options['filename'] || null;\n this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;\n this.onWarning = options['onWarning'] || null;\n this.legacy = options['legacy'] || false;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.typeMap = this.schema.compiledTypeMap;\n\n this.length = input.length;\n this.position = 0;\n this.line = 0;\n this.lineStart = 0;\n this.lineIndent = 0;\n\n this.documents = [];\n\n /*\n this.version;\n this.checkLineBreaks;\n this.tagMap;\n this.anchorMap;\n this.tag;\n this.anchor;\n this.kind;\n this.result;*/\n\n}\n\n\nfunction generateError(state, message) {\n return new YAMLException(\n message,\n new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));\n}\n\nfunction throwError(state, message) {\n throw generateError(state, message);\n}\n\nfunction throwWarning(state, message) {\n if (state.onWarning) {\n state.onWarning.call(null, generateError(state, message));\n }\n}\n\n\nvar directiveHandlers = {\n\n YAML: function handleYamlDirective(state, name, args) {\n\n var match, major, minor;\n\n if (null !== state.version) {\n throwError(state, 'duplication of %YAML directive');\n }\n\n if (1 !== args.length) {\n throwError(state, 'YAML directive accepts exactly one argument');\n }\n\n match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0]);\n\n if (null === match) {\n throwError(state, 'ill-formed argument of the YAML directive');\n }\n\n major = parseInt(match[1], 10);\n minor = parseInt(match[2], 10);\n\n if (1 !== major) {\n throwError(state, 'unacceptable YAML version of the document');\n }\n\n state.version = args[0];\n state.checkLineBreaks = (minor < 2);\n\n if (1 !== minor && 2 !== minor) {\n throwWarning(state, 'unsupported YAML version of the document');\n }\n },\n\n TAG: function handleTagDirective(state, name, args) {\n\n var handle, prefix;\n\n if (2 !== args.length) {\n throwError(state, 'TAG directive accepts exactly two arguments');\n }\n\n handle = args[0];\n prefix = args[1];\n\n if (!PATTERN_TAG_HANDLE.test(handle)) {\n throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');\n }\n\n if (_hasOwnProperty.call(state.tagMap, handle)) {\n throwError(state, 'there is a previously declared suffix for \"' + handle + '\" tag handle');\n }\n\n if (!PATTERN_TAG_URI.test(prefix)) {\n throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');\n }\n\n state.tagMap[handle] = prefix;\n }\n};\n\n\nfunction captureSegment(state, start, end, checkJson) {\n var _position, _length, _character, _result;\n\n if (start < end) {\n _result = state.input.slice(start, end);\n\n if (checkJson) {\n for (_position = 0, _length = _result.length;\n _position < _length;\n _position += 1) {\n _character = _result.charCodeAt(_position);\n if (!(0x09 === _character ||\n 0x20 <= _character && _character <= 0x10FFFF)) {\n throwError(state, 'expected valid JSON character');\n }\n }\n } else if (PATTERN_NON_PRINTABLE.test(_result)) {\n throwError(state, 'the stream contains non-printable characters');\n }\n\n state.result += _result;\n }\n}\n\nfunction mergeMappings(state, destination, source) {\n var sourceKeys, key, index, quantity;\n\n if (!common.isObject(source)) {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable');\n }\n\n sourceKeys = Object.keys(source);\n\n for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {\n key = sourceKeys[index];\n\n if (!_hasOwnProperty.call(destination, key)) {\n destination[key] = source[key];\n }\n }\n}\n\nfunction storeMappingPair(state, _result, keyTag, keyNode, valueNode) {\n var index, quantity;\n\n keyNode = String(keyNode);\n\n if (null === _result) {\n _result = {};\n }\n\n if ('tag:yaml.org,2002:merge' === keyTag) {\n if (Array.isArray(valueNode)) {\n for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {\n mergeMappings(state, _result, valueNode[index]);\n }\n } else {\n mergeMappings(state, _result, valueNode);\n }\n } else {\n _result[keyNode] = valueNode;\n }\n\n return _result;\n}\n\nfunction readLineBreak(state) {\n var ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x0A/* LF */ === ch) {\n state.position++;\n } else if (0x0D/* CR */ === ch) {\n state.position++;\n if (0x0A/* LF */ === state.input.charCodeAt(state.position)) {\n state.position++;\n }\n } else {\n throwError(state, 'a line break is expected');\n }\n\n state.line += 1;\n state.lineStart = state.position;\n}\n\nfunction skipSeparationSpace(state, allowComments, checkIndent) {\n var lineBreaks = 0,\n ch = state.input.charCodeAt(state.position);\n\n while (0 !== ch) {\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (allowComments && 0x23/* # */ === ch) {\n do {\n ch = state.input.charCodeAt(++state.position);\n } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch);\n }\n\n if (is_EOL(ch)) {\n readLineBreak(state);\n\n ch = state.input.charCodeAt(state.position);\n lineBreaks++;\n state.lineIndent = 0;\n\n while (0x20/* Space */ === ch) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n } else {\n break;\n }\n }\n\n if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) {\n throwWarning(state, 'deficient indentation');\n }\n\n return lineBreaks;\n}\n\nfunction testDocumentSeparator(state) {\n var _position = state.position,\n ch;\n\n ch = state.input.charCodeAt(_position);\n\n // Condition state.position === state.lineStart is tested\n // in parent on each call, for efficiency. No needs to test here again.\n if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) &&\n state.input.charCodeAt(_position + 1) === ch &&\n state.input.charCodeAt(_position + 2) === ch) {\n\n _position += 3;\n\n ch = state.input.charCodeAt(_position);\n\n if (ch === 0 || is_WS_OR_EOL(ch)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction writeFoldedLines(state, count) {\n if (1 === count) {\n state.result += ' ';\n } else if (count > 1) {\n state.result += common.repeat('\\n', count - 1);\n }\n}\n\n\nfunction readPlainScalar(state, nodeIndent, withinFlowCollection) {\n var preceding,\n following,\n captureStart,\n captureEnd,\n hasPendingContent,\n _line,\n _lineStart,\n _lineIndent,\n _kind = state.kind,\n _result = state.result,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (is_WS_OR_EOL(ch) ||\n is_FLOW_INDICATOR(ch) ||\n 0x23/* # */ === ch ||\n 0x26/* & */ === ch ||\n 0x2A/* * */ === ch ||\n 0x21/* ! */ === ch ||\n 0x7C/* | */ === ch ||\n 0x3E/* > */ === ch ||\n 0x27/* ' */ === ch ||\n 0x22/* \" */ === ch ||\n 0x25/* % */ === ch ||\n 0x40/* @ */ === ch ||\n 0x60/* ` */ === ch) {\n return false;\n }\n\n if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n return false;\n }\n }\n\n state.kind = 'scalar';\n state.result = '';\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n\n while (0 !== ch) {\n if (0x3A/* : */ === ch) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n break;\n }\n\n } else if (0x23/* # */ === ch) {\n preceding = state.input.charCodeAt(state.position - 1);\n\n if (is_WS_OR_EOL(preceding)) {\n break;\n }\n\n } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||\n withinFlowCollection && is_FLOW_INDICATOR(ch)) {\n break;\n\n } else if (is_EOL(ch)) {\n _line = state.line;\n _lineStart = state.lineStart;\n _lineIndent = state.lineIndent;\n skipSeparationSpace(state, false, -1);\n\n if (state.lineIndent >= nodeIndent) {\n hasPendingContent = true;\n ch = state.input.charCodeAt(state.position);\n continue;\n } else {\n state.position = captureEnd;\n state.line = _line;\n state.lineStart = _lineStart;\n state.lineIndent = _lineIndent;\n break;\n }\n }\n\n if (hasPendingContent) {\n captureSegment(state, captureStart, captureEnd, false);\n writeFoldedLines(state, state.line - _line);\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n }\n\n if (!is_WHITE_SPACE(ch)) {\n captureEnd = state.position + 1;\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, captureEnd, false);\n\n if (state.result) {\n return true;\n }\n\n state.kind = _kind;\n state.result = _result;\n return false;\n}\n\nfunction readSingleQuotedScalar(state, nodeIndent) {\n var ch,\n captureStart, captureEnd;\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x27/* ' */ !== ch) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while (0 !== (ch = state.input.charCodeAt(state.position))) {\n if (0x27/* ' */ === ch) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (0x27/* ' */ === ch) {\n captureStart = captureEnd = state.position;\n state.position++;\n } else {\n return true;\n }\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a single quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a single quoted scalar');\n}\n\nfunction readDoubleQuotedScalar(state, nodeIndent) {\n var captureStart,\n captureEnd,\n hexLength,\n hexResult,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x22/* \" */ !== ch) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while (0 !== (ch = state.input.charCodeAt(state.position))) {\n if (0x22/* \" */ === ch) {\n captureSegment(state, captureStart, state.position, true);\n state.position++;\n return true;\n\n } else if (0x5C/* \\ */ === ch) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (is_EOL(ch)) {\n skipSeparationSpace(state, false, nodeIndent);\n\n // TODO: rework to inline fn with no type cast?\n } else if (ch < 256 && simpleEscapeCheck[ch]) {\n state.result += simpleEscapeMap[ch];\n state.position++;\n\n } else if ((tmp = escapedHexLen(ch)) > 0) {\n hexLength = tmp;\n hexResult = 0;\n\n for (; hexLength > 0; hexLength--) {\n ch = state.input.charCodeAt(++state.position);\n\n if ((tmp = fromHexCode(ch)) >= 0) {\n hexResult = (hexResult << 4) + tmp;\n\n } else {\n throwError(state, 'expected hexadecimal character');\n }\n }\n\n state.result += charFromCodepoint(hexResult);\n\n state.position++;\n\n } else {\n throwError(state, 'unknown escape sequence');\n }\n\n captureStart = captureEnd = state.position;\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a double quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a double quoted scalar');\n}\n\nfunction readFlowCollection(state, nodeIndent) {\n var readNext = true,\n _line,\n _tag = state.tag,\n _result,\n _anchor = state.anchor,\n following,\n terminator,\n isPair,\n isExplicitPair,\n isMapping,\n keyNode,\n keyTag,\n valueNode,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x5B/* [ */) {\n terminator = 0x5D;/* ] */\n isMapping = false;\n _result = [];\n } else if (ch === 0x7B/* { */) {\n terminator = 0x7D;/* } */\n isMapping = true;\n _result = {};\n } else {\n return false;\n }\n\n if (null !== state.anchor) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n while (0 !== ch) {\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === terminator) {\n state.position++;\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = isMapping ? 'mapping' : 'sequence';\n state.result = _result;\n return true;\n } else if (!readNext) {\n throwError(state, 'missed comma between flow collection entries');\n }\n\n keyTag = keyNode = valueNode = null;\n isPair = isExplicitPair = false;\n\n if (0x3F/* ? */ === ch) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following)) {\n isPair = isExplicitPair = true;\n state.position++;\n skipSeparationSpace(state, true, nodeIndent);\n }\n }\n\n _line = state.line;\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n keyTag = state.tag;\n keyNode = state.result;\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) {\n isPair = true;\n ch = state.input.charCodeAt(++state.position);\n skipSeparationSpace(state, true, nodeIndent);\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n valueNode = state.result;\n }\n\n if (isMapping) {\n storeMappingPair(state, _result, keyTag, keyNode, valueNode);\n } else if (isPair) {\n _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode));\n } else {\n _result.push(keyNode);\n }\n\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x2C/* , */ === ch) {\n readNext = true;\n ch = state.input.charCodeAt(++state.position);\n } else {\n readNext = false;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a flow collection');\n}\n\nfunction readBlockScalar(state, nodeIndent) {\n var captureStart,\n folding,\n chomping = CHOMPING_CLIP,\n detectedIndent = false,\n textIndent = nodeIndent,\n emptyLines = 0,\n atMoreIndented = false,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x7C/* | */) {\n folding = false;\n } else if (ch === 0x3E/* > */) {\n folding = true;\n } else {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n\n while (0 !== ch) {\n ch = state.input.charCodeAt(++state.position);\n\n if (0x2B/* + */ === ch || 0x2D/* - */ === ch) {\n if (CHOMPING_CLIP === chomping) {\n chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP;\n } else {\n throwError(state, 'repeat of a chomping mode identifier');\n }\n\n } else if ((tmp = fromDecimalCode(ch)) >= 0) {\n if (tmp === 0) {\n throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');\n } else if (!detectedIndent) {\n textIndent = nodeIndent + tmp - 1;\n detectedIndent = true;\n } else {\n throwError(state, 'repeat of an indentation width identifier');\n }\n\n } else {\n break;\n }\n }\n\n if (is_WHITE_SPACE(ch)) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (is_WHITE_SPACE(ch));\n\n if (0x23/* # */ === ch) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (!is_EOL(ch) && (0 !== ch));\n }\n }\n\n while (0 !== ch) {\n readLineBreak(state);\n state.lineIndent = 0;\n\n ch = state.input.charCodeAt(state.position);\n\n while ((!detectedIndent || state.lineIndent < textIndent) &&\n (0x20/* Space */ === ch)) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (!detectedIndent && state.lineIndent > textIndent) {\n textIndent = state.lineIndent;\n }\n\n if (is_EOL(ch)) {\n emptyLines++;\n continue;\n }\n\n // End of the scalar.\n if (state.lineIndent < textIndent) {\n\n // Perform the chomping.\n if (chomping === CHOMPING_KEEP) {\n state.result += common.repeat('\\n', emptyLines);\n } else if (chomping === CHOMPING_CLIP) {\n if (detectedIndent) { // i.e. only if the scalar is not empty.\n state.result += '\\n';\n }\n }\n\n // Break this `while` cycle and go to the funciton's epilogue.\n break;\n }\n\n // Folded style: use fancy rules to handle line breaks.\n if (folding) {\n\n // Lines starting with white space characters (more-indented lines) are not folded.\n if (is_WHITE_SPACE(ch)) {\n atMoreIndented = true;\n state.result += common.repeat('\\n', emptyLines + 1);\n\n // End of more-indented block.\n } else if (atMoreIndented) {\n atMoreIndented = false;\n state.result += common.repeat('\\n', emptyLines + 1);\n\n // Just one line break - perceive as the same line.\n } else if (0 === emptyLines) {\n if (detectedIndent) { // i.e. only if we have already read some scalar content.\n state.result += ' ';\n }\n\n // Several line breaks - perceive as different lines.\n } else {\n state.result += common.repeat('\\n', emptyLines);\n }\n\n // Literal style: just add exact number of line breaks between content lines.\n } else if (detectedIndent) {\n // If current line isn't the first one - count line break from the last content line.\n state.result += common.repeat('\\n', emptyLines + 1);\n } else {\n // In case of the first content line - count only empty lines.\n state.result += common.repeat('\\n', emptyLines);\n }\n\n detectedIndent = true;\n emptyLines = 0;\n captureStart = state.position;\n\n while (!is_EOL(ch) && (0 !== ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, state.position, false);\n }\n\n return true;\n}\n\nfunction readBlockSequence(state, nodeIndent) {\n var _line,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = [],\n following,\n detected = false,\n ch;\n\n if (null !== state.anchor) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (0 !== ch) {\n\n if (0x2D/* - */ !== ch) {\n break;\n }\n\n following = state.input.charCodeAt(state.position + 1);\n\n if (!is_WS_OR_EOL(following)) {\n break;\n }\n\n detected = true;\n state.position++;\n\n if (skipSeparationSpace(state, true, -1)) {\n if (state.lineIndent <= nodeIndent) {\n _result.push(null);\n ch = state.input.charCodeAt(state.position);\n continue;\n }\n }\n\n _line = state.line;\n composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);\n _result.push(state.result);\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) {\n throwError(state, 'bad indentation of a sequence entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'sequence';\n state.result = _result;\n return true;\n }\n return false;\n}\n\nfunction readBlockMapping(state, nodeIndent, flowIndent) {\n var following,\n allowCompact,\n _line,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = {},\n keyTag = null,\n keyNode = null,\n valueNode = null,\n atExplicitKey = false,\n detected = false,\n ch;\n\n if (null !== state.anchor) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (0 !== ch) {\n following = state.input.charCodeAt(state.position + 1);\n _line = state.line; // Save the current line.\n\n //\n // Explicit notation case. There are two separate blocks:\n // first for the key (denoted by \"?\") and second for the value (denoted by \":\")\n //\n if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) {\n\n if (0x3F/* ? */ === ch) {\n if (atExplicitKey) {\n storeMappingPair(state, _result, keyTag, keyNode, null);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = true;\n allowCompact = true;\n\n } else if (atExplicitKey) {\n // i.e. 0x3A/* : */ === character after the explicit key.\n atExplicitKey = false;\n allowCompact = true;\n\n } else {\n throwError(state, 'incomplete explicit mapping pair; a key node is missed');\n }\n\n state.position += 1;\n ch = following;\n\n //\n // Implicit notation case. Flow-style node as the key first, then \":\", and the value.\n //\n } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\n\n if (state.line === _line) {\n ch = state.input.charCodeAt(state.position);\n\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (0x3A/* : */ === ch) {\n ch = state.input.charCodeAt(++state.position);\n\n if (!is_WS_OR_EOL(ch)) {\n throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');\n }\n\n if (atExplicitKey) {\n storeMappingPair(state, _result, keyTag, keyNode, null);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = false;\n allowCompact = false;\n keyTag = state.tag;\n keyNode = state.result;\n\n } else if (detected) {\n throwError(state, 'can not read an implicit mapping pair; a colon is missed');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n\n } else if (detected) {\n throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n\n } else {\n break; // Reading is done. Go to the epilogue.\n }\n\n //\n // Common reading code for both explicit and implicit notations.\n //\n if (state.line === _line || state.lineIndent > nodeIndent) {\n if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {\n if (atExplicitKey) {\n keyNode = state.result;\n } else {\n valueNode = state.result;\n }\n }\n\n if (!atExplicitKey) {\n storeMappingPair(state, _result, keyTag, keyNode, valueNode);\n keyTag = keyNode = valueNode = null;\n }\n\n skipSeparationSpace(state, true, -1);\n ch = state.input.charCodeAt(state.position);\n }\n\n if (state.lineIndent > nodeIndent && (0 !== ch)) {\n throwError(state, 'bad indentation of a mapping entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n //\n // Epilogue.\n //\n\n // Special case: last mapping's node contains only the key in explicit notation.\n if (atExplicitKey) {\n storeMappingPair(state, _result, keyTag, keyNode, null);\n }\n\n // Expose the resulting mapping.\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'mapping';\n state.result = _result;\n }\n\n return detected;\n}\n\nfunction readTagProperty(state) {\n var _position,\n isVerbatim = false,\n isNamed = false,\n tagHandle,\n tagName,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x21/* ! */ !== ch) {\n return false;\n }\n\n if (null !== state.tag) {\n throwError(state, 'duplication of a tag property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n if (0x3C/* < */ === ch) {\n isVerbatim = true;\n ch = state.input.charCodeAt(++state.position);\n\n } else if (0x21/* ! */ === ch) {\n isNamed = true;\n tagHandle = '!!';\n ch = state.input.charCodeAt(++state.position);\n\n } else {\n tagHandle = '!';\n }\n\n _position = state.position;\n\n if (isVerbatim) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (0 !== ch && 0x3E/* > */ !== ch);\n\n if (state.position < state.length) {\n tagName = state.input.slice(_position, state.position);\n ch = state.input.charCodeAt(++state.position);\n } else {\n throwError(state, 'unexpected end of the stream within a verbatim tag');\n }\n } else {\n while (0 !== ch && !is_WS_OR_EOL(ch)) {\n\n if (0x21/* ! */ === ch) {\n if (!isNamed) {\n tagHandle = state.input.slice(_position - 1, state.position + 1);\n\n if (!PATTERN_TAG_HANDLE.test(tagHandle)) {\n throwError(state, 'named tag handle cannot contain such characters');\n }\n\n isNamed = true;\n _position = state.position + 1;\n } else {\n throwError(state, 'tag suffix cannot contain exclamation marks');\n }\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n tagName = state.input.slice(_position, state.position);\n\n if (PATTERN_FLOW_INDICATORS.test(tagName)) {\n throwError(state, 'tag suffix cannot contain flow indicator characters');\n }\n }\n\n if (tagName && !PATTERN_TAG_URI.test(tagName)) {\n throwError(state, 'tag name cannot contain such characters: ' + tagName);\n }\n\n if (isVerbatim) {\n state.tag = tagName;\n\n } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {\n state.tag = state.tagMap[tagHandle] + tagName;\n\n } else if ('!' === tagHandle) {\n state.tag = '!' + tagName;\n\n } else if ('!!' === tagHandle) {\n state.tag = 'tag:yaml.org,2002:' + tagName;\n\n } else {\n throwError(state, 'undeclared tag handle \"' + tagHandle + '\"');\n }\n\n return true;\n}\n\nfunction readAnchorProperty(state) {\n var _position,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x26/* & */ !== ch) {\n return false;\n }\n\n if (null !== state.anchor) {\n throwError(state, 'duplication of an anchor property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an anchor node must contain at least one character');\n }\n\n state.anchor = state.input.slice(_position, state.position);\n return true;\n}\n\nfunction readAlias(state) {\n var _position, alias,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (0x2A/* * */ !== ch) {\n return false;\n }\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an alias node must contain at least one character');\n }\n\n alias = state.input.slice(_position, state.position);\n\n if (!state.anchorMap.hasOwnProperty(alias)) {\n throwError(state, 'unidentified alias \"' + alias + '\"');\n }\n\n state.result = state.anchorMap[alias];\n skipSeparationSpace(state, true, -1);\n return true;\n}\n\nfunction composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {\n var allowBlockStyles,\n allowBlockScalars,\n allowBlockCollections,\n indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n }\n }\n\n if (1 === indentStatus) {\n while (readTagProperty(state) || readAnchorProperty(state)) {\n if (skipSeparationSpace(state, true, -1)) {\n atNewLine = true;\n allowBlockCollections = allowBlockStyles;\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n } else {\n allowBlockCollections = false;\n }\n }\n }\n\n if (allowBlockCollections) {\n allowBlockCollections = atNewLine || allowCompact;\n }\n\n if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {\n if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {\n flowIndent = parentIndent;\n } else {\n flowIndent = parentIndent + 1;\n }\n\n blockIndent = state.position - state.lineStart;\n\n if (1 === indentStatus) {\n if (allowBlockCollections &&\n (readBlockSequence(state, blockIndent) ||\n readBlockMapping(state, blockIndent, flowIndent)) ||\n readFlowCollection(state, flowIndent)) {\n hasContent = true;\n } else {\n if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||\n readSingleQuotedScalar(state, flowIndent) ||\n readDoubleQuotedScalar(state, flowIndent)) {\n hasContent = true;\n\n } else if (readAlias(state)) {\n hasContent = true;\n\n if (null !== state.tag || null !== state.anchor) {\n throwError(state, 'alias node should not have any properties');\n }\n\n } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {\n hasContent = true;\n\n if (null === state.tag) {\n state.tag = '?';\n }\n }\n\n if (null !== state.anchor) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n } else if (0 === indentStatus) {\n // Special case: block sequences are allowed to have same indentation level as the parent.\n // http://www.yaml.org/spec/1.2/spec.html#id2799784\n hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);\n }\n }\n\n if (null !== state.tag && '!' !== state.tag) {\n if ('?' === state.tag) {\n for (typeIndex = 0, typeQuantity = state.implicitTypes.length;\n typeIndex < typeQuantity;\n typeIndex += 1) {\n type = state.implicitTypes[typeIndex];\n\n // Implicit resolving is not allowed for non-scalar types, and '?'\n // non-specific tag is only assigned to plain scalars. So, it isn't\n // needed to check for 'kind' conformity.\n\n if (type.resolve(state.result)) { // `state.result` updated in resolver if matched\n state.result = type.construct(state.result);\n state.tag = type.tag;\n if (null !== state.anchor) {\n state.anchorMap[state.anchor] = state.result;\n }\n break;\n }\n }\n } else if (_hasOwnProperty.call(state.typeMap, state.tag)) {\n type = state.typeMap[state.tag];\n\n if (null !== state.result && type.kind !== state.kind) {\n throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be \"' + type.kind + '\", not \"' + state.kind + '\"');\n }\n\n if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched\n throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');\n } else {\n state.result = type.construct(state.result);\n if (null !== state.anchor) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n } else {\n throwError(state, 'unknown tag !<' + state.tag + '>');\n }\n }\n\n return null !== state.tag || null !== state.anchor || hasContent;\n}\n\nfunction readDocument(state) {\n var documentStart = state.position,\n _position,\n directiveName,\n directiveArgs,\n hasDirectives = false,\n ch;\n\n state.version = null;\n state.checkLineBreaks = state.legacy;\n state.tagMap = {};\n state.anchorMap = {};\n\n while (0 !== (ch = state.input.charCodeAt(state.position))) {\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if (state.lineIndent > 0 || 0x25/* % */ !== ch) {\n break;\n }\n\n hasDirectives = true;\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (0 !== ch && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveName = state.input.slice(_position, state.position);\n directiveArgs = [];\n\n if (directiveName.length < 1) {\n throwError(state, 'directive name must not be less than one character in length');\n }\n\n while (0 !== ch) {\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (0x23/* # */ === ch) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (0 !== ch && !is_EOL(ch));\n break;\n }\n\n if (is_EOL(ch)) {\n break;\n }\n\n _position = state.position;\n\n while (0 !== ch && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveArgs.push(state.input.slice(_position, state.position));\n }\n\n if (0 !== ch) {\n readLineBreak(state);\n }\n\n if (_hasOwnProperty.call(directiveHandlers, directiveName)) {\n directiveHandlers[directiveName](state, directiveName, directiveArgs);\n } else {\n throwWarning(state, 'unknown document directive \"' + directiveName + '\"');\n }\n }\n\n skipSeparationSpace(state, true, -1);\n\n if (0 === state.lineIndent &&\n 0x2D/* - */ === state.input.charCodeAt(state.position) &&\n 0x2D/* - */ === state.input.charCodeAt(state.position + 1) &&\n 0x2D/* - */ === state.input.charCodeAt(state.position + 2)) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n\n } else if (hasDirectives) {\n throwError(state, 'directives end mark is expected');\n }\n\n composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);\n skipSeparationSpace(state, true, -1);\n\n if (state.checkLineBreaks &&\n PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {\n throwWarning(state, 'non-ASCII line breaks are interpreted as content');\n }\n\n state.documents.push(state.result);\n\n if (state.position === state.lineStart && testDocumentSeparator(state)) {\n\n if (0x2E/* . */ === state.input.charCodeAt(state.position)) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n }\n return;\n }\n\n if (state.position < (state.length - 1)) {\n throwError(state, 'end of the stream or a document separator is expected');\n } else {\n return;\n }\n}\n\n\nfunction loadDocuments(input, options) {\n input = String(input);\n options = options || {};\n\n if (input.length !== 0) {\n\n // Add tailing `\\n` if not exists\n if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&\n 0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {\n input += '\\n';\n }\n\n // Strip BOM\n if (input.charCodeAt(0) === 0xFEFF) {\n input = input.slice(1);\n }\n }\n\n var state = new State(input, options);\n\n // Use 0 as string terminator. That significantly simplifies bounds check.\n state.input += '\\0';\n\n while (0x20/* Space */ === state.input.charCodeAt(state.position)) {\n state.lineIndent += 1;\n state.position += 1;\n }\n\n while (state.position < (state.length - 1)) {\n readDocument(state);\n }\n\n return state.documents;\n}\n\n\nfunction loadAll(input, iterator, options) {\n var documents = loadDocuments(input, options), index, length;\n\n for (index = 0, length = documents.length; index < length; index += 1) {\n iterator(documents[index]);\n }\n}\n\n\nfunction load(input, options) {\n var documents = loadDocuments(input, options);\n\n if (0 === documents.length) {\n /*eslint-disable no-undefined*/\n return undefined;\n } else if (1 === documents.length) {\n return documents[0];\n }\n throw new YAMLException('expected a single document in the stream, but found more');\n}\n\n\nfunction safeLoadAll(input, output, options) {\n loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));\n}\n\n\nfunction safeLoad(input, options) {\n return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));\n}\n\n\nmodule.exports.loadAll = loadAll;\nmodule.exports.load = load;\nmodule.exports.safeLoadAll = safeLoadAll;\nmodule.exports.safeLoad = safeLoad;\n", + "'use strict';\n\n\nvar common = require('./common');\n\n\nfunction Mark(name, buffer, position, line, column) {\n this.name = name;\n this.buffer = buffer;\n this.position = position;\n this.line = line;\n this.column = column;\n}\n\n\nMark.prototype.getSnippet = function getSnippet(indent, maxLength) {\n var head, start, tail, end, snippet;\n\n if (!this.buffer) {\n return null;\n }\n\n indent = indent || 4;\n maxLength = maxLength || 75;\n\n head = '';\n start = this.position;\n\n while (start > 0 && -1 === '\\x00\\r\\n\\x85\\u2028\\u2029'.indexOf(this.buffer.charAt(start - 1))) {\n start -= 1;\n if (this.position - start > (maxLength / 2 - 1)) {\n head = ' ... ';\n start += 5;\n break;\n }\n }\n\n tail = '';\n end = this.position;\n\n while (end < this.buffer.length && -1 === '\\x00\\r\\n\\x85\\u2028\\u2029'.indexOf(this.buffer.charAt(end))) {\n end += 1;\n if (end - this.position > (maxLength / 2 - 1)) {\n tail = ' ... ';\n end -= 5;\n break;\n }\n }\n\n snippet = this.buffer.slice(start, end);\n\n return common.repeat(' ', indent) + head + snippet + tail + '\\n' +\n common.repeat(' ', indent + this.position - start + head.length) + '^';\n};\n\n\nMark.prototype.toString = function toString(compact) {\n var snippet, where = '';\n\n if (this.name) {\n where += 'in \"' + this.name + '\" ';\n }\n\n where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);\n\n if (!compact) {\n snippet = this.getSnippet();\n\n if (snippet) {\n where += ':\\n' + snippet;\n }\n }\n\n return where;\n};\n\n\nmodule.exports = Mark;\n", + "'use strict';\n\n/*eslint-disable max-len*/\n\nvar common = require('./common');\nvar YAMLException = require('./exception');\nvar Type = require('./type');\n\n\nfunction compileList(schema, name, result) {\n var exclude = [];\n\n schema.include.forEach(function (includedSchema) {\n result = compileList(includedSchema, name, result);\n });\n\n schema[name].forEach(function (currentType) {\n result.forEach(function (previousType, previousIndex) {\n if (previousType.tag === currentType.tag) {\n exclude.push(previousIndex);\n }\n });\n\n result.push(currentType);\n });\n\n return result.filter(function (type, index) {\n return -1 === exclude.indexOf(index);\n });\n}\n\n\nfunction compileMap(/* lists... */) {\n var result = {}, index, length;\n\n function collectType(type) {\n result[type.tag] = type;\n }\n\n for (index = 0, length = arguments.length; index < length; index += 1) {\n arguments[index].forEach(collectType);\n }\n\n return result;\n}\n\n\nfunction Schema(definition) {\n this.include = definition.include || [];\n this.implicit = definition.implicit || [];\n this.explicit = definition.explicit || [];\n\n this.implicit.forEach(function (type) {\n if (type.loadKind && 'scalar' !== type.loadKind) {\n throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');\n }\n });\n\n this.compiledImplicit = compileList(this, 'implicit', []);\n this.compiledExplicit = compileList(this, 'explicit', []);\n this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);\n}\n\n\nSchema.DEFAULT = null;\n\n\nSchema.create = function createSchema() {\n var schemas, types;\n\n switch (arguments.length) {\n case 1:\n schemas = Schema.DEFAULT;\n types = arguments[0];\n break;\n\n case 2:\n schemas = arguments[0];\n types = arguments[1];\n break;\n\n default:\n throw new YAMLException('Wrong number of arguments for Schema.create function');\n }\n\n schemas = common.toArray(schemas);\n types = common.toArray(types);\n\n if (!schemas.every(function (schema) { return schema instanceof Schema; })) {\n throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');\n }\n\n if (!types.every(function (type) { return type instanceof Type; })) {\n throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');\n }\n\n return new Schema({\n include: schemas,\n explicit: types\n });\n};\n\n\nmodule.exports = Schema;\n", "// Standard YAML's Core schema.\n// http://www.yaml.org/spec/1.2/spec.html#id2804923\n//\n// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.\n// So, Core schema has no distinctions from JSON schema is JS-YAML.\n\n\n'use strict';\n\n\nvar Schema = require('../schema');\n\n\nmodule.exports = new Schema({\n include: [\n require('./json')\n ]\n});\n", "// JS-YAML's default schema for `load` function.\n// It is not described in the YAML specification.\n//\n// This schema is based on JS-YAML's default safe schema and includes\n// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.\n//\n// Also this schema is used as default base schema at `Schema.create` function.\n\n\n'use strict';\n\n\nvar Schema = require('../schema');\n\n\nmodule.exports = Schema.DEFAULT = new Schema({\n include: [\n require('./default_safe')\n ],\n explicit: [\n require('../type/js/undefined'),\n require('../type/js/regexp'),\n require('../type/js/function')\n ]\n});\n", "// JS-YAML's default schema for `safeLoad` function.\n// It is not described in the YAML specification.\n//\n// This schema is based on standard YAML's Core schema and includes most of\n// extra types described at YAML tag repository. (http://yaml.org/type/)\n\n\n'use strict';\n\n\nvar Schema = require('../schema');\n\n\nmodule.exports = new Schema({\n include: [\n require('./core')\n ],\n implicit: [\n require('../type/timestamp'),\n require('../type/merge')\n ],\n explicit: [\n require('../type/binary'),\n require('../type/omap'),\n require('../type/pairs'),\n require('../type/set')\n ]\n});\n", "// Standard YAML's Failsafe schema.\n// http://www.yaml.org/spec/1.2/spec.html#id2802346\n\n\n'use strict';\n\n\nvar Schema = require('../schema');\n\n\nmodule.exports = new Schema({\n explicit: [\n require('../type/str'),\n require('../type/seq'),\n require('../type/map')\n ]\n});\n", "// Standard YAML's JSON schema.\n// http://www.yaml.org/spec/1.2/spec.html#id2803231\n//\n// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.\n// So, this schema is not such strict as defined in the YAML specification.\n// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.\n\n\n'use strict';\n\n\nvar Schema = require('../schema');\n\n\nmodule.exports = new Schema({\n include: [\n require('./failsafe')\n ],\n implicit: [\n require('../type/null'),\n require('../type/bool'),\n require('../type/int'),\n require('../type/float')\n ]\n});\n", - "'use strict';\n\nvar YAMLException = require('./exception');\n\nvar TYPE_CONSTRUCTOR_OPTIONS = [\n 'kind',\n 'resolve',\n 'construct',\n 'instanceOf',\n 'predicate',\n 'represent',\n 'defaultStyle',\n 'styleAliases'\n];\n\nvar YAML_NODE_KINDS = [\n 'scalar',\n 'sequence',\n 'mapping'\n];\n\nfunction compileStyleAliases(map) {\n var result = {};\n\n if (map !== null) {\n Object.keys(map).forEach(function (style) {\n map[style].forEach(function (alias) {\n result[String(alias)] = style;\n });\n });\n }\n\n return result;\n}\n\nfunction Type(tag, options) {\n options = options || {};\n\n Object.keys(options).forEach(function (name) {\n if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {\n throw new YAMLException('Unknown option \"' + name + '\" is met in definition of \"' + tag + '\" YAML type.');\n }\n });\n\n // TODO: Add tag format check.\n this.tag = tag;\n this.kind = options['kind'] || null;\n this.resolve = options['resolve'] || function () { return true; };\n this.construct = options['construct'] || function (data) { return data; };\n this.instanceOf = options['instanceOf'] || null;\n this.predicate = options['predicate'] || null;\n this.represent = options['represent'] || null;\n this.defaultStyle = options['defaultStyle'] || null;\n this.styleAliases = compileStyleAliases(options['styleAliases'] || null);\n\n if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {\n throw new YAMLException('Unknown kind \"' + this.kind + '\" is specified for \"' + tag + '\" YAML type.');\n }\n}\n\nmodule.exports = Type;\n", - "'use strict';\n\n/*eslint-disable no-bitwise*/\n\n// A trick for browserified version.\n// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined\nvar NodeBuffer = require('buffer').Buffer;\nvar Type = require('../type');\n\n\n// [ 64, 65, 66 ] -> [ padding, CR, LF ]\nvar BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\\n\\r';\n\n\nfunction resolveYamlBinary(data) {\n if (data === null) return false;\n\n var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;\n\n // Convert one by one.\n for (idx = 0; idx < max; idx++) {\n code = map.indexOf(data.charAt(idx));\n\n // Skip CR/LF\n if (code > 64) continue;\n\n // Fail on illegal characters\n if (code < 0) return false;\n\n bitlen += 6;\n }\n\n // If there are any bits left, source was corrupted\n return (bitlen % 8) === 0;\n}\n\nfunction constructYamlBinary(data) {\n var idx, tailbits,\n input = data.replace(/[\\r\\n=]/g, ''), // remove CR/LF & padding to simplify scan\n max = input.length,\n map = BASE64_MAP,\n bits = 0,\n result = [];\n\n // Collect by 6*4 bits (3 bytes)\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 4 === 0) && idx) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n }\n\n bits = (bits << 6) | map.indexOf(input.charAt(idx));\n }\n\n // Dump tail\n\n tailbits = (max % 4) * 6;\n\n if (tailbits === 0) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n } else if (tailbits === 18) {\n result.push((bits >> 10) & 0xFF);\n result.push((bits >> 2) & 0xFF);\n } else if (tailbits === 12) {\n result.push((bits >> 4) & 0xFF);\n }\n\n // Wrap into Buffer for NodeJS and leave Array for browser\n if (NodeBuffer) return new NodeBuffer(result);\n\n return result;\n}\n\nfunction representYamlBinary(object /*, style*/) {\n var result = '', bits = 0, idx, tail,\n max = object.length,\n map = BASE64_MAP;\n\n // Convert every three bytes to 4 ASCII characters.\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 3 === 0) && idx) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n }\n\n bits = (bits << 8) + object[idx];\n }\n\n // Dump tail\n\n tail = max % 3;\n\n if (tail === 0) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n } else if (tail === 2) {\n result += map[(bits >> 10) & 0x3F];\n result += map[(bits >> 4) & 0x3F];\n result += map[(bits << 2) & 0x3F];\n result += map[64];\n } else if (tail === 1) {\n result += map[(bits >> 2) & 0x3F];\n result += map[(bits << 4) & 0x3F];\n result += map[64];\n result += map[64];\n }\n\n return result;\n}\n\nfunction isBinary(object) {\n return NodeBuffer && NodeBuffer.isBuffer(object);\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:binary', {\n kind: 'scalar',\n resolve: resolveYamlBinary,\n construct: constructYamlBinary,\n predicate: isBinary,\n represent: representYamlBinary\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nfunction resolveYamlBoolean(data) {\n if (data === null) return false;\n\n var max = data.length;\n\n return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||\n (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));\n}\n\nfunction constructYamlBoolean(data) {\n return data === 'true' ||\n data === 'True' ||\n data === 'TRUE';\n}\n\nfunction isBoolean(object) {\n return Object.prototype.toString.call(object) === '[object Boolean]';\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:bool', {\n kind: 'scalar',\n resolve: resolveYamlBoolean,\n construct: constructYamlBoolean,\n predicate: isBoolean,\n represent: {\n lowercase: function (object) { return object ? 'true' : 'false'; },\n uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },\n camelcase: function (object) { return object ? 'True' : 'False'; }\n },\n defaultStyle: 'lowercase'\n});\n", - "'use strict';\n\nvar common = require('../common');\nvar Type = require('../type');\n\nvar YAML_FLOAT_PATTERN = new RegExp(\n '^(?:[-+]?(?:[0-9][0-9_]*)\\\\.[0-9_]*(?:[eE][-+][0-9]+)?' +\n '|\\\\.[0-9_]+(?:[eE][-+][0-9]+)?' +\n '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*' +\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n '|\\\\.(?:nan|NaN|NAN))$');\n\nfunction resolveYamlFloat(data) {\n if (data === null) return false;\n\n if (!YAML_FLOAT_PATTERN.test(data)) return false;\n\n return true;\n}\n\nfunction constructYamlFloat(data) {\n var value, sign, base, digits;\n\n value = data.replace(/_/g, '').toLowerCase();\n sign = value[0] === '-' ? -1 : 1;\n digits = [];\n\n if ('+-'.indexOf(value[0]) >= 0) {\n value = value.slice(1);\n }\n\n if (value === '.inf') {\n return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;\n\n } else if (value === '.nan') {\n return NaN;\n\n } else if (value.indexOf(':') >= 0) {\n value.split(':').forEach(function (v) {\n digits.unshift(parseFloat(v, 10));\n });\n\n value = 0.0;\n base = 1;\n\n digits.forEach(function (d) {\n value += d * base;\n base *= 60;\n });\n\n return sign * value;\n\n }\n return sign * parseFloat(value, 10);\n}\n\n\nvar SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;\n\nfunction representYamlFloat(object, style) {\n var res;\n\n if (isNaN(object)) {\n switch (style) {\n case 'lowercase': return '.nan';\n case 'uppercase': return '.NAN';\n case 'camelcase': return '.NaN';\n }\n } else if (Number.POSITIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '.inf';\n case 'uppercase': return '.INF';\n case 'camelcase': return '.Inf';\n }\n } else if (Number.NEGATIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '-.inf';\n case 'uppercase': return '-.INF';\n case 'camelcase': return '-.Inf';\n }\n } else if (common.isNegativeZero(object)) {\n return '-0.0';\n }\n\n res = object.toString(10);\n\n // JS stringifier can build scientific format without dots: 5e-100,\n // while YAML requres dot: 5.e-100. Fix it with simple hack\n\n return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;\n}\n\nfunction isFloat(object) {\n return (Object.prototype.toString.call(object) === '[object Number]') &&\n (object % 1 !== 0 || common.isNegativeZero(object));\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:float', {\n kind: 'scalar',\n resolve: resolveYamlFloat,\n construct: constructYamlFloat,\n predicate: isFloat,\n represent: representYamlFloat,\n defaultStyle: 'lowercase'\n});\n", - "'use strict';\n\nvar common = require('../common');\nvar Type = require('../type');\n\nfunction isHexCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||\n ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||\n ((0x61/* a */ <= c) && (c <= 0x66/* f */));\n}\n\nfunction isOctCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));\n}\n\nfunction isDecCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));\n}\n\nfunction resolveYamlInteger(data) {\n if (data === null) return false;\n\n var max = data.length,\n index = 0,\n hasDigits = false,\n ch;\n\n if (!max) return false;\n\n ch = data[index];\n\n // sign\n if (ch === '-' || ch === '+') {\n ch = data[++index];\n }\n\n if (ch === '0') {\n // 0\n if (index + 1 === max) return true;\n ch = data[++index];\n\n // base 2, base 8, base 16\n\n if (ch === 'b') {\n // base 2\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (ch !== '0' && ch !== '1') return false;\n hasDigits = true;\n }\n return hasDigits;\n }\n\n\n if (ch === 'x') {\n // base 16\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isHexCode(data.charCodeAt(index))) return false;\n hasDigits = true;\n }\n return hasDigits;\n }\n\n // base 8\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isOctCode(data.charCodeAt(index))) return false;\n hasDigits = true;\n }\n return hasDigits;\n }\n\n // base 10 (except 0) or base 60\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (ch === ':') break;\n if (!isDecCode(data.charCodeAt(index))) {\n return false;\n }\n hasDigits = true;\n }\n\n if (!hasDigits) return false;\n\n // if !base60 - done;\n if (ch !== ':') return true;\n\n // base60 almost not used, no needs to optimize\n return /^(:[0-5]?[0-9])+$/.test(data.slice(index));\n}\n\nfunction constructYamlInteger(data) {\n var value = data, sign = 1, ch, base, digits = [];\n\n if (value.indexOf('_') !== -1) {\n value = value.replace(/_/g, '');\n }\n\n ch = value[0];\n\n if (ch === '-' || ch === '+') {\n if (ch === '-') sign = -1;\n value = value.slice(1);\n ch = value[0];\n }\n\n if (value === '0') return 0;\n\n if (ch === '0') {\n if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);\n if (value[1] === 'x') return sign * parseInt(value, 16);\n return sign * parseInt(value, 8);\n }\n\n if (value.indexOf(':') !== -1) {\n value.split(':').forEach(function (v) {\n digits.unshift(parseInt(v, 10));\n });\n\n value = 0;\n base = 1;\n\n digits.forEach(function (d) {\n value += (d * base);\n base *= 60;\n });\n\n return sign * value;\n\n }\n\n return sign * parseInt(value, 10);\n}\n\nfunction isInteger(object) {\n return (Object.prototype.toString.call(object)) === '[object Number]' &&\n (object % 1 === 0 && !common.isNegativeZero(object));\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:int', {\n kind: 'scalar',\n resolve: resolveYamlInteger,\n construct: constructYamlInteger,\n predicate: isInteger,\n represent: {\n binary: function (object) { return '0b' + object.toString(2); },\n octal: function (object) { return '0' + object.toString(8); },\n decimal: function (object) { return object.toString(10); },\n hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }\n },\n defaultStyle: 'decimal',\n styleAliases: {\n binary: [ 2, 'bin' ],\n octal: [ 8, 'oct' ],\n decimal: [ 10, 'dec' ],\n hexadecimal: [ 16, 'hex' ]\n }\n});\n", - "'use strict';\n\nvar esprima;\n\n// Browserified version does not have esprima\n//\n// 1. For node.js just require module as deps\n// 2. For browser try to require mudule via external AMD system.\n// If not found - try to fallback to window.esprima. If not\n// found too - then fail to parse.\n//\ntry {\n // workaround to exclude package from browserify list.\n var _require = require;\n esprima = _require('esprima');\n} catch (_) {\n /*global window */\n if (typeof window !== 'undefined') esprima = window.esprima;\n}\n\nvar Type = require('../../type');\n\nfunction resolveJavascriptFunction(data) {\n if (data === null) return false;\n\n try {\n var source = '(' + data + ')',\n ast = esprima.parse(source, { range: true });\n\n if (ast.type !== 'Program' ||\n ast.body.length !== 1 ||\n ast.body[0].type !== 'ExpressionStatement' ||\n ast.body[0].expression.type !== 'FunctionExpression') {\n return false;\n }\n\n return true;\n } catch (err) {\n return false;\n }\n}\n\nfunction constructJavascriptFunction(data) {\n /*jslint evil:true*/\n\n var source = '(' + data + ')',\n ast = esprima.parse(source, { range: true }),\n params = [],\n body;\n\n if (ast.type !== 'Program' ||\n ast.body.length !== 1 ||\n ast.body[0].type !== 'ExpressionStatement' ||\n ast.body[0].expression.type !== 'FunctionExpression') {\n throw new Error('Failed to resolve function');\n }\n\n ast.body[0].expression.params.forEach(function (param) {\n params.push(param.name);\n });\n\n body = ast.body[0].expression.body.range;\n\n // Esprima's ranges include the first '{' and the last '}' characters on\n // function expressions. So cut them out.\n /*eslint-disable no-new-func*/\n return new Function(params, source.slice(body[0] + 1, body[1] - 1));\n}\n\nfunction representJavascriptFunction(object /*, style*/) {\n return object.toString();\n}\n\nfunction isFunction(object) {\n return Object.prototype.toString.call(object) === '[object Function]';\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:js/function', {\n kind: 'scalar',\n resolve: resolveJavascriptFunction,\n construct: constructJavascriptFunction,\n predicate: isFunction,\n represent: representJavascriptFunction\n});\n", - "'use strict';\n\nvar Type = require('../../type');\n\nfunction resolveJavascriptRegExp(data) {\n if (data === null) return false;\n if (data.length === 0) return false;\n\n var regexp = data,\n tail = /\\/([gim]*)$/.exec(data),\n modifiers = '';\n\n // if regexp starts with '/' it can have modifiers and must be properly closed\n // `/foo/gim` - modifiers tail can be maximum 3 chars\n if (regexp[0] === '/') {\n if (tail) modifiers = tail[1];\n\n if (modifiers.length > 3) return false;\n // if expression starts with /, is should be properly terminated\n if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;\n }\n\n return true;\n}\n\nfunction constructJavascriptRegExp(data) {\n var regexp = data,\n tail = /\\/([gim]*)$/.exec(data),\n modifiers = '';\n\n // `/foo/gim` - tail can be maximum 4 chars\n if (regexp[0] === '/') {\n if (tail) modifiers = tail[1];\n regexp = regexp.slice(1, regexp.length - modifiers.length - 1);\n }\n\n return new RegExp(regexp, modifiers);\n}\n\nfunction representJavascriptRegExp(object /*, style*/) {\n var result = '/' + object.source + '/';\n\n if (object.global) result += 'g';\n if (object.multiline) result += 'm';\n if (object.ignoreCase) result += 'i';\n\n return result;\n}\n\nfunction isRegExp(object) {\n return Object.prototype.toString.call(object) === '[object RegExp]';\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:js/regexp', {\n kind: 'scalar',\n resolve: resolveJavascriptRegExp,\n construct: constructJavascriptRegExp,\n predicate: isRegExp,\n represent: representJavascriptRegExp\n});\n", - "'use strict';\n\nvar Type = require('../../type');\n\nfunction resolveJavascriptUndefined() {\n return true;\n}\n\nfunction constructJavascriptUndefined() {\n /*eslint-disable no-undefined*/\n return undefined;\n}\n\nfunction representJavascriptUndefined() {\n return '';\n}\n\nfunction isUndefined(object) {\n return typeof object === 'undefined';\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:js/undefined', {\n kind: 'scalar',\n resolve: resolveJavascriptUndefined,\n construct: constructJavascriptUndefined,\n predicate: isUndefined,\n represent: representJavascriptUndefined\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nmodule.exports = new Type('tag:yaml.org,2002:map', {\n kind: 'mapping',\n construct: function (data) { return data !== null ? data : {}; }\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nfunction resolveYamlMerge(data) {\n return data === '<<' || data === null;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:merge', {\n kind: 'scalar',\n resolve: resolveYamlMerge\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nfunction resolveYamlNull(data) {\n if (data === null) return true;\n\n var max = data.length;\n\n return (max === 1 && data === '~') ||\n (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));\n}\n\nfunction constructYamlNull() {\n return null;\n}\n\nfunction isNull(object) {\n return object === null;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:null', {\n kind: 'scalar',\n resolve: resolveYamlNull,\n construct: constructYamlNull,\n predicate: isNull,\n represent: {\n canonical: function () { return '~'; },\n lowercase: function () { return 'null'; },\n uppercase: function () { return 'NULL'; },\n camelcase: function () { return 'Null'; }\n },\n defaultStyle: 'lowercase'\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\nvar _toString = Object.prototype.toString;\n\nfunction resolveYamlOmap(data) {\n if (data === null) return true;\n\n var objectKeys = [], index, length, pair, pairKey, pairHasKey,\n object = data;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n pairHasKey = false;\n\n if (_toString.call(pair) !== '[object Object]') return false;\n\n for (pairKey in pair) {\n if (_hasOwnProperty.call(pair, pairKey)) {\n if (!pairHasKey) pairHasKey = true;\n else return false;\n }\n }\n\n if (!pairHasKey) return false;\n\n if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);\n else return false;\n }\n\n return true;\n}\n\nfunction constructYamlOmap(data) {\n return data !== null ? data : [];\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:omap', {\n kind: 'sequence',\n resolve: resolveYamlOmap,\n construct: constructYamlOmap\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nvar _toString = Object.prototype.toString;\n\nfunction resolveYamlPairs(data) {\n if (data === null) return true;\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n if (_toString.call(pair) !== '[object Object]') return false;\n\n keys = Object.keys(pair);\n\n if (keys.length !== 1) return false;\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return true;\n}\n\nfunction constructYamlPairs(data) {\n if (data === null) return [];\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n keys = Object.keys(pair);\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return result;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:pairs', {\n kind: 'sequence',\n resolve: resolveYamlPairs,\n construct: constructYamlPairs\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nmodule.exports = new Type('tag:yaml.org,2002:seq', {\n kind: 'sequence',\n construct: function (data) { return data !== null ? data : []; }\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction resolveYamlSet(data) {\n if (data === null) return true;\n\n var key, object = data;\n\n for (key in object) {\n if (_hasOwnProperty.call(object, key)) {\n if (object[key] !== null) return false;\n }\n }\n\n return true;\n}\n\nfunction constructYamlSet(data) {\n return data !== null ? data : {};\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:set', {\n kind: 'mapping',\n resolve: resolveYamlSet,\n construct: constructYamlSet\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nmodule.exports = new Type('tag:yaml.org,2002:str', {\n kind: 'scalar',\n construct: function (data) { return data !== null ? data : ''; }\n});\n", - "'use strict';\n\nvar Type = require('../type');\n\nvar YAML_DATE_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9])' + // [2] month\n '-([0-9][0-9])$'); // [3] day\n\nvar YAML_TIMESTAMP_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9]?)' + // [2] month\n '-([0-9][0-9]?)' + // [3] day\n '(?:[Tt]|[ \\\\t]+)' + // ...\n '([0-9][0-9]?)' + // [4] hour\n ':([0-9][0-9])' + // [5] minute\n ':([0-9][0-9])' + // [6] second\n '(?:\\\\.([0-9]*))?' + // [7] fraction\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour\n '(?::([0-9][0-9]))?))?$'); // [11] tz_minute\n\nfunction resolveYamlTimestamp(data) {\n if (data === null) return false;\n if (YAML_DATE_REGEXP.exec(data) !== null) return true;\n if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;\n return false;\n}\n\nfunction constructYamlTimestamp(data) {\n var match, year, month, day, hour, minute, second, fraction = 0,\n delta = null, tz_hour, tz_minute, date;\n\n match = YAML_DATE_REGEXP.exec(data);\n if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);\n\n if (match === null) throw new Error('Date resolve error');\n\n // match: [1] year [2] month [3] day\n\n year = +(match[1]);\n month = +(match[2]) - 1; // JS month starts with 0\n day = +(match[3]);\n\n if (!match[4]) { // no hour\n return new Date(Date.UTC(year, month, day));\n }\n\n // match: [4] hour [5] minute [6] second [7] fraction\n\n hour = +(match[4]);\n minute = +(match[5]);\n second = +(match[6]);\n\n if (match[7]) {\n fraction = match[7].slice(0, 3);\n while (fraction.length < 3) { // milli-seconds\n fraction += '0';\n }\n fraction = +fraction;\n }\n\n // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute\n\n if (match[9]) {\n tz_hour = +(match[10]);\n tz_minute = +(match[11] || 0);\n delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds\n if (match[9] === '-') delta = -delta;\n }\n\n date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));\n\n if (delta) date.setTime(date.getTime() - delta);\n\n return date;\n}\n\nfunction representYamlTimestamp(object /*, style*/) {\n return object.toISOString();\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:timestamp', {\n kind: 'scalar',\n resolve: resolveYamlTimestamp,\n construct: constructYamlTimestamp,\n instanceOf: Date,\n represent: representYamlTimestamp\n});\n", - "/** !\n * JSON Schema $Ref Parser v3.0.2\n *\n * @link https://github.com/BigstickCarpet/json-schema-ref-parser\n * @license MIT\n */\n'use strict';\n\nvar $Ref = require('./ref'),\n Pointer = require('./pointer'),\n debug = require('./util/debug'),\n url = require('./util/url');\n\nmodule.exports = bundle;\n\n/**\n * Bundles all external JSON references into the main JSON schema, thus resulting in a schema that\n * only has *internal* references, not any *external* references.\n * This method mutates the JSON schema object, adding new references and re-mapping existing ones.\n *\n * @param {$RefParser} parser\n * @param {$RefParserOptions} options\n */\nfunction bundle(parser, options) {\n debug('Bundling $ref pointers in %s', parser.$refs._root$Ref.path);\n\n // Build an inventory of all $ref pointers in the JSON Schema\n var inventory = [];\n crawl(parser, 'schema', parser.$refs._root$Ref.path + '#', '#', inventory, parser.$refs, options);\n\n // Remap all $ref pointers\n remap(inventory);\n}\n\n/**\n * Recursively crawls the given value, and inventories all JSON references.\n *\n * @param {object} parent - The object containing the value to crawl. If the value is not an object or array, it will be ignored.\n * @param {string} key - The property key of `parent` to be crawled\n * @param {string} path - The full path of the property being crawled, possibly with a JSON Pointer in the hash\n * @param {string} pathFromRoot - The path of the property being crawled, from the schema root\n * @param {object[]} inventory - An array of already-inventoried $ref pointers\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n */\nfunction crawl(parent, key, path, pathFromRoot, inventory, $refs, options) {\n var obj = key === null ? parent : parent[key];\n\n if (obj && typeof obj === 'object') {\n if ($Ref.is$Ref(obj)) {\n inventory$Ref(parent, key, path, pathFromRoot, inventory, $refs, options);\n }\n else {\n var keys = Object.keys(obj);\n\n // Most people will expect references to be bundled into the the \"definitions\" property,\n // so we always crawl that property first, if it exists.\n var defs = keys.indexOf('definitions');\n if (defs > 0) {\n keys.splice(0, 0, keys.splice(defs, 1)[0]);\n }\n\n keys.forEach(function(key) {\n var keyPath = Pointer.join(path, key);\n var keyPathFromRoot = Pointer.join(pathFromRoot, key);\n var value = obj[key];\n\n if ($Ref.is$Ref(value)) {\n inventory$Ref(obj, key, path, keyPathFromRoot, inventory, $refs, options);\n }\n else {\n crawl(obj, key, keyPath, keyPathFromRoot, inventory, $refs, options);\n }\n });\n }\n }\n}\n\n/**\n * Inventories the given JSON Reference (i.e. records detailed information about it so we can\n * optimize all $refs in the schema), and then crawls the resolved value.\n *\n * @param {object} $refParent - The object that contains a JSON Reference as one of its keys\n * @param {string} $refKey - The key in `$refParent` that is a JSON Reference\n * @param {string} path - The full path of the JSON Reference at `$refKey`, possibly with a JSON Pointer in the hash\n * @param {string} pathFromRoot - The path of the JSON Reference at `$refKey`, from the schema root\n * @param {object[]} inventory - An array of already-inventoried $ref pointers\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n */\nfunction inventory$Ref($refParent, $refKey, path, pathFromRoot, inventory, $refs, options) {\n if (inventory.some(function(i) { return i.parent === $refParent && i.key === $refKey; })) {\n // This $Ref has already been inventoried, so we don't need to process it again\n return;\n }\n\n var $ref = $refKey === null ? $refParent : $refParent[$refKey];\n var $refPath = url.resolve(path, $ref.$ref);\n var pointer = $refs._resolve($refPath, options);\n var depth = Pointer.parse(pathFromRoot).length;\n var file = url.stripHash(pointer.path);\n var hash = url.getHash(pointer.path);\n var external = file !== $refs._root$Ref.path;\n var extended = $Ref.isExtended$Ref($ref);\n\n inventory.push({\n $ref: $ref, // The JSON Reference (e.g. {$ref: string})\n parent: $refParent, // The object that contains this $ref pointer\n key: $refKey, // The key in `parent` that is the $ref pointer\n pathFromRoot: pathFromRoot, // The path to the $ref pointer, from the JSON Schema root\n depth: depth, // How far from the JSON Schema root is this $ref pointer?\n file: file, // The file that the $ref pointer resolves to\n hash: hash, // The hash within `file` that the $ref pointer resolves to\n value: pointer.value, // The resolved value of the $ref pointer\n circular: pointer.circular, // Is this $ref pointer DIRECTLY circular? (i.e. it references itself)\n extended: extended, // Does this $ref extend its resolved value? (i.e. it has extra properties, in addition to \"$ref\")\n external: external // Does this $ref pointer point to a file other than the main JSON Schema file?\n });\n\n // Recursively crawl the resolved value\n crawl(pointer.value, null, pointer.path, pathFromRoot, inventory, $refs, options);\n}\n\n/**\n * Re-maps every $ref pointer, so that they're all relative to the root of the JSON Schema.\n * Each referenced value is dereferenced EXACTLY ONCE. All subsequent references to the same\n * value are re-mapped to point to the first reference.\n *\n * @example:\n * {\n * first: { $ref: somefile.json#/some/part },\n * second: { $ref: somefile.json#/another/part },\n * third: { $ref: somefile.json },\n * fourth: { $ref: somefile.json#/some/part/sub/part }\n * }\n *\n * In this example, there are four references to the same file, but since the third reference points\n * to the ENTIRE file, that's the only one we need to dereference. The other three can just be\n * remapped to point inside the third one.\n *\n * On the other hand, if the third reference DIDN'T exist, then the first and second would both need\n * to be dereferenced, since they point to different parts of the file. The fourth reference does NOT\n * need to be dereferenced, because it can be remapped to point inside the first one.\n *\n * @param {object[]} inventory\n */\nfunction remap(inventory) {\n // Group & sort all the $ref pointers, so they're in the order that we need to dereference/remap them\n inventory.sort(function(a, b) {\n if (a.file !== b.file) {\n return a.file < b.file ? -1 : +1; // Group all the $refs that point to the same file\n }\n else if (a.hash !== b.hash) {\n return a.hash < b.hash ? -1 : +1; // Group all the $refs that point to the same part of the file\n }\n else if (a.circular !== b.circular) {\n return a.circular ? -1 : +1; // If the $ref points to itself, then sort it higher than other $refs that point to this $ref\n }\n else if (a.extended !== b.extended) {\n return a.extended ? +1 : -1; // If the $ref extends the resolved value, then sort it lower than other $refs that don't extend the value\n }\n else if (a.depth !== b.depth) {\n return a.depth - b.depth; // Sort $refs by how close they are to the JSON Schema root\n }\n else {\n // If all else is equal, use the $ref that's in the \"definitions\" property\n return b.pathFromRoot.lastIndexOf('/definitions') - a.pathFromRoot.lastIndexOf('/definitions');\n }\n });\n\n var file, hash, pathFromRoot;\n inventory.forEach(function(i) {\n debug('Re-mapping $ref pointer \"%s\" at %s', i.$ref.$ref, i.pathFromRoot);\n\n if (!i.external) {\n // This $ref already resolves to the main JSON Schema file\n i.$ref.$ref = i.hash;\n }\n else if (i.file === file && i.hash === hash) {\n // This $ref points to the same value as the prevous $ref, so remap it to the same path\n i.$ref.$ref = pathFromRoot;\n }\n else if (i.file === file && i.hash.indexOf(hash + '/') === 0) {\n // This $ref points to the a sub-value as the prevous $ref, so remap it beneath that path\n i.$ref.$ref = Pointer.join(pathFromRoot, Pointer.parse(i.hash));\n }\n else {\n // We've moved to a new file or new hash\n file = i.file;\n hash = i.hash;\n pathFromRoot = i.pathFromRoot;\n\n // This is the first $ref to point to this value, so dereference the value.\n // Any other $refs that point to the same value will point to this $ref instead\n i.$ref = i.parent[i.key] = $Ref.dereference(i.$ref, i.value);\n\n if (i.circular) {\n // This $ref points to itself\n i.$ref.$ref = i.pathFromRoot;\n }\n }\n\n debug(' new value: %s', (i.$ref && i.$ref.$ref) ? i.$ref.$ref : '[object Object]');\n });\n}\n", - "'use strict';\n\nvar $Ref = require('./ref'),\n Pointer = require('./pointer'),\n ono = require('ono'),\n debug = require('./util/debug'),\n url = require('./util/url');\n\nmodule.exports = dereference;\n\n/**\n * Crawls the JSON schema, finds all JSON references, and dereferences them.\n * This method mutates the JSON schema object, replacing JSON references with their resolved value.\n *\n * @param {$RefParser} parser\n * @param {$RefParserOptions} options\n */\nfunction dereference(parser, options) {\n debug('Dereferencing $ref pointers in %s', parser.$refs._root$Ref.path);\n var dereferenced = crawl(parser.schema, parser.$refs._root$Ref.path, '#', [], parser.$refs, options);\n parser.$refs.circular = dereferenced.circular;\n parser.schema = dereferenced.value;\n}\n\n/**\n * Recursively crawls the given value, and dereferences any JSON references.\n *\n * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored.\n * @param {string} path - The full path of `obj`, possibly with a JSON Pointer in the hash\n * @param {string} pathFromRoot - The path of `obj` from the schema root\n * @param {object[]} parents - An array of the parent objects that have already been dereferenced\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n * @returns {{value: object, circular: boolean}}\n */\nfunction crawl(obj, path, pathFromRoot, parents, $refs, options) {\n var dereferenced;\n var result = {\n value: obj,\n circular: false\n };\n\n if (obj && typeof obj === 'object') {\n parents.push(obj);\n\n if ($Ref.isAllowed$Ref(obj, options)) {\n dereferenced = dereference$Ref(obj, path, pathFromRoot, parents, $refs, options);\n result.circular = dereferenced.circular;\n result.value = dereferenced.value;\n }\n else {\n Object.keys(obj).forEach(function(key) {\n var keyPath = Pointer.join(path, key);\n var keyPathFromRoot = Pointer.join(pathFromRoot, key);\n var value = obj[key];\n var circular = false;\n\n if ($Ref.isAllowed$Ref(value, options)) {\n dereferenced = dereference$Ref(value, keyPath, keyPathFromRoot, parents, $refs, options);\n circular = dereferenced.circular;\n obj[key] = dereferenced.value;\n }\n else {\n if (parents.indexOf(value) === -1) {\n dereferenced = crawl(value, keyPath, keyPathFromRoot, parents, $refs, options);\n circular = dereferenced.circular;\n obj[key] = dereferenced.value;\n }\n else {\n circular = foundCircularReference(keyPath, $refs, options);\n }\n }\n\n // Set the \"isCircular\" flag if this or any other property is circular\n result.circular = result.circular || circular;\n });\n }\n\n parents.pop();\n }\n\n return result;\n}\n\n/**\n * Dereferences the given JSON Reference, and then crawls the resulting value.\n *\n * @param {{$ref: string}} $ref - The JSON Reference to resolve\n * @param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash\n * @param {string} pathFromRoot - The path of `$ref` from the schema root\n * @param {object[]} parents - An array of the parent objects that have already been dereferenced\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n * @returns {{value: object, circular: boolean}}\n */\nfunction dereference$Ref($ref, path, pathFromRoot, parents, $refs, options) {\n debug('Dereferencing $ref pointer \"%s\" at %s', $ref.$ref, path);\n\n var $refPath = url.resolve(path, $ref.$ref);\n var pointer = $refs._resolve($refPath, options);\n\n // Check for circular references\n var directCircular = pointer.circular;\n var circular = directCircular || parents.indexOf(pointer.value) !== -1;\n circular && foundCircularReference(path, $refs, options);\n\n // Dereference the JSON reference\n var dereferencedValue = $Ref.dereference($ref, pointer.value);\n\n // Crawl the dereferenced value (unless it's circular)\n if (!circular) {\n // Determine if the dereferenced value is circular\n var dereferenced = crawl(dereferencedValue, pointer.path, pathFromRoot, parents, $refs, options);\n circular = dereferenced.circular;\n dereferencedValue = dereferenced.value;\n }\n\n if (circular && !directCircular && options.dereference.circular === 'ignore') {\n // The user has chosen to \"ignore\" circular references, so don't change the value\n dereferencedValue = $ref;\n }\n\n if (directCircular) {\n // The pointer is a DIRECT circular reference (i.e. it references itself).\n // So replace the $ref path with the absolute path from the JSON Schema root\n dereferencedValue.$ref = pathFromRoot;\n }\n\n return {\n circular: circular,\n value: dereferencedValue\n };\n}\n\n/**\n * Called when a circular reference is found.\n * It sets the {@link $Refs#circular} flag, and throws an error if options.dereference.circular is false.\n *\n * @param {string} keyPath - The JSON Reference path of the circular reference\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n * @returns {boolean} - always returns true, to indicate that a circular reference was found\n */\nfunction foundCircularReference(keyPath, $refs, options) {\n $refs.circular = true;\n if (!options.dereference.circular) {\n throw ono.reference('Circular $ref pointer found at %s', keyPath);\n }\n return true;\n}\n", - "'use strict';\n\nvar Promise = require('./util/promise'),\n Options = require('./options'),\n $Refs = require('./refs'),\n parse = require('./parse'),\n resolve = require('./resolve'),\n bundle = require('./bundle'),\n dereference = require('./dereference'),\n url = require('./util/url'),\n maybe = require('call-me-maybe'),\n ono = require('ono');\n\nmodule.exports = $RefParser;\nmodule.exports.YAML = require('./util/yaml');\n\n/**\n * This class parses a JSON schema, builds a map of its JSON references and their resolved values,\n * and provides methods for traversing, manipulating, and dereferencing those references.\n *\n * @constructor\n */\nfunction $RefParser() {\n /**\n * The parsed (and possibly dereferenced) JSON schema object\n *\n * @type {object}\n * @readonly\n */\n this.schema = null;\n\n /**\n * The resolved JSON references\n *\n * @type {$Refs}\n * @readonly\n */\n this.$refs = new $Refs();\n}\n\n/**\n * Parses the given JSON schema.\n * This method does not resolve any JSON references.\n * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed\n * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.\n * @returns {Promise} - The returned promise resolves with the parsed JSON schema object.\n */\n$RefParser.parse = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().parse(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema.\n * This method does not resolve any JSON references.\n * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed\n * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.\n * @returns {Promise} - The returned promise resolves with the parsed JSON schema object.\n */\n$RefParser.prototype.parse = function(schema, options, callback) {\n var args = normalizeArgs(arguments);\n var promise;\n\n if (!args.schema || (typeof args.schema !== 'string' && typeof args.schema !== 'object')) {\n var err = ono('Expected a file path, URL, or object. Got %s', args.schema);\n return maybe(args.callback, Promise.reject(err));\n }\n\n // Reset everything\n this.schema = null;\n this.$refs = new $Refs();\n\n if (typeof args.schema === 'object') {\n // The schema is an object, not a path/url.\n // So immediately add a new $Ref with the schema object as its value\n this.$refs._add('', args.schema);\n promise = Promise.resolve(args.schema);\n }\n else {\n // The schema is a path/url\n var path = args.schema;\n\n // If it's a filesystem path, then convert it to a URL.\n // NOTE: According to the JSON Reference spec, these should already be URLs,\n // but, in practice, many people use local filesystem paths instead.\n // So we're being generous here and doing the conversion automatically.\n // This is not intended to be a 100% bulletproof solution.\n // If it doesn't work for your use-case, then use a URL instead.\n if (url.isFileSystemPath(path)) {\n path = url.fromFileSystemPath(path);\n }\n\n // Resolve the absolute path of the schema\n path = url.resolve(url.cwd(), path);\n\n // Parse the schema file/url\n promise = parse(path, this.$refs, args.options);\n }\n\n var me = this;\n return promise\n .then(function(result) {\n if (!result || typeof result !== 'object' || Buffer.isBuffer(result)) {\n throw ono.syntax('\"%s\" is not a valid JSON Schema', me.$refs._root$Ref.path || result);\n }\n else {\n me.schema = result;\n return maybe(args.callback, Promise.resolve(me.schema));\n }\n })\n .catch(function(e) {\n return maybe(args.callback, Promise.reject(e));\n });\n};\n\n/**\n * Parses the given JSON schema and resolves any JSON references, including references in\n * externally-referenced files.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved\n * @param {function} [callback]\n * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references\n *\n * @returns {Promise}\n * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references\n */\n$RefParser.resolve = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().resolve(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema and resolves any JSON references, including references in\n * externally-referenced files.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved\n * @param {function} [callback]\n * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references\n *\n * @returns {Promise}\n * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references\n */\n$RefParser.prototype.resolve = function(schema, options, callback) {\n var me = this;\n var args = normalizeArgs(arguments);\n\n return this.parse(args.schema, args.options)\n .then(function() {\n return resolve(me, args.options);\n })\n .then(function() {\n return maybe(args.callback, Promise.resolve(me.$refs));\n })\n .catch(function(err) {\n return maybe(args.callback, Promise.reject(err));\n });\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and bundles all external references\n * into the main JSON schema. This produces a JSON schema that only has *internal* references,\n * not any *external* references.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object\n * @returns {Promise} - The returned promise resolves with the bundled JSON schema object.\n */\n$RefParser.bundle = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().bundle(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and bundles all external references\n * into the main JSON schema. This produces a JSON schema that only has *internal* references,\n * not any *external* references.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object\n * @returns {Promise} - The returned promise resolves with the bundled JSON schema object.\n */\n$RefParser.prototype.bundle = function(schema, options, callback) {\n var me = this;\n var args = normalizeArgs(arguments);\n\n return this.resolve(args.schema, args.options)\n .then(function() {\n bundle(me, args.options);\n return maybe(args.callback, Promise.resolve(me.schema));\n })\n .catch(function(err) {\n return maybe(args.callback, Promise.reject(err));\n });\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema.\n * That is, all JSON references are replaced with their resolved values.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object\n * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.\n */\n$RefParser.dereference = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().dereference(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema.\n * That is, all JSON references are replaced with their resolved values.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object\n * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.\n */\n$RefParser.prototype.dereference = function(schema, options, callback) {\n var me = this;\n var args = normalizeArgs(arguments);\n\n return this.resolve(args.schema, args.options)\n .then(function() {\n dereference(me, args.options);\n return maybe(args.callback, Promise.resolve(me.schema));\n })\n .catch(function(err) {\n return maybe(args.callback, Promise.reject(err));\n });\n};\n\n/**\n * Normalizes the given arguments, accounting for optional args.\n *\n * @param {Arguments} args\n * @returns {object}\n */\nfunction normalizeArgs(args) {\n var options = args[1], callback = args[2];\n if (typeof options === 'function') {\n callback = options;\n options = undefined;\n }\n if (!(options instanceof Options)) {\n options = new Options(options);\n }\n return {\n schema: args[0],\n options: options,\n callback: callback\n };\n}\n", - "/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */\n'use strict';\n\nvar jsonParser = require('./parsers/json'),\n yamlParser = require('./parsers/yaml'),\n textParser = require('./parsers/text'),\n binaryParser = require('./parsers/binary'),\n fileResolver = require('./resolvers/file'),\n httpResolver = require('./resolvers/http');\n\nmodule.exports = $RefParserOptions;\n\n/**\n * Options that determine how JSON schemas are parsed, resolved, and dereferenced.\n *\n * @param {object|$RefParserOptions} [options] - Overridden options\n * @constructor\n */\nfunction $RefParserOptions(options) {\n merge(this, $RefParserOptions.defaults);\n merge(this, options);\n}\n\n$RefParserOptions.defaults = {\n /**\n * Determines how different types of files will be parsed.\n *\n * You can add additional parsers of your own, replace an existing one with\n * your own implemenation, or disable any parser by setting it to false.\n *\n * Each of the built-in parsers has the following options:\n *\n * order {number} - The order in which the parsers will run\n *\n * ext {string[]} - An array of file extensions and/or RegExp patterns.\n * Only matching files will be parsed by this parser.\n *\n * empty {boolean} - Whether to allow \"empty\" files. Enabled by default.\n * \"Empty\" includes zero-byte files, as well as JSON/YAML files that\n * don't contain any keys.\n */\n parse: {\n json: jsonParser,\n yaml: yamlParser,\n text: textParser,\n binary: binaryParser,\n },\n\n /**\n * Determines how JSON References will be resolved.\n *\n * You can add additional resolvers of your own, replace an existing one with\n * your own implemenation, or disable any resolver by setting it to false.\n *\n * Each of the built-in resolvers has the following options:\n *\n * order {number} - The order in which the resolver will run\n *\n * The HTTP resolver has additional options. See read/http.js for details.\n */\n resolve: {\n file: fileResolver,\n http: httpResolver,\n\n /**\n * Determines whether external $ref pointers will be resolved.\n * If this option is disabled, then none of above resolvers will be called.\n * Instead, external $ref pointers will simply be ignored.\n *\n * @type {boolean}\n */\n external: true,\n },\n\n /**\n * Determines the types of JSON references that are allowed.\n */\n dereference: {\n /**\n * Dereference circular (recursive) JSON references?\n * If false, then a {@link ReferenceError} will be thrown if a circular reference is found.\n * If \"ignore\", then circular references will not be dereferenced.\n *\n * @type {boolean|string}\n */\n circular: true\n },\n};\n\n/**\n * Merges the properties of the source object into the target object.\n *\n * @param {object} target - The object that we're populating\n * @param {?object} source - The options that are being merged\n * @returns {object}\n */\nfunction merge(target, source) {\n if (isMergeable(source)) {\n var keys = Object.keys(source);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var sourceSetting = source[key];\n var targetSetting = target[key];\n\n if (isMergeable(sourceSetting)) {\n // It's a nested object, so merge it recursively\n target[key] = merge(targetSetting || {}, sourceSetting);\n }\n else if (sourceSetting !== undefined) {\n // It's a scalar value, function, or array. No merging necessary. Just overwrite the target value.\n target[key] = sourceSetting;\n }\n }\n }\n return target;\n}\n\n/**\n * Determines whether the given value can be merged,\n * or if it is a scalar value that should just override the target value.\n *\n * @param {*} val\n * @returns {Boolean}\n */\nfunction isMergeable(val) {\n return val &&\n (typeof val === 'object') &&\n !Array.isArray(val) &&\n !(val instanceof RegExp) &&\n !(val instanceof Date);\n}\n", - "'use strict';\n\nvar ono = require('ono'),\n debug = require('./util/debug'),\n url = require('./util/url'),\n plugins = require('./util/plugins'),\n Promise = require('./util/promise');\n\nmodule.exports = parse;\n\n/**\n * Reads and parses the specified file path or URL.\n *\n * @param {string} path - This path MUST already be resolved, since `read` doesn't know the resolution context\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves with the parsed file contents, NOT the raw (Buffer) contents.\n */\nfunction parse(path, $refs, options) {\n try {\n // Remove the URL fragment, if any\n path = url.stripHash(path);\n\n // Add a new $Ref for this file, even though we don't have the value yet.\n // This ensures that we don't simultaneously read & parse the same file multiple times\n var $ref = $refs._add(path);\n\n // This \"file object\" will be passed to all resolvers and parsers.\n var file = {\n url: path,\n extension: url.getExtension(path),\n };\n\n // Read the file and then parse the data\n return readFile(file, options)\n .then(function(resolver) {\n $ref.pathType = resolver.plugin.name;\n file.data = resolver.result;\n return parseFile(file, options);\n })\n .then(function(parser) {\n $ref.value = parser.result;\n return parser.result;\n });\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Reads the given file, using the configured resolver plugins\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves with the raw file contents and the resolver that was used.\n */\nfunction readFile(file, options) {\n return new Promise(function(resolve, reject) {\n debug('Reading %s', file.url);\n\n // Find the resolvers that can read this file\n var resolvers = plugins.all(options.resolve);\n resolvers = plugins.filter(resolvers, 'canRead', file);\n\n // Run the resolvers, in order, until one of them succeeds\n plugins.sort(resolvers);\n plugins.run(resolvers, 'read', file)\n .then(resolve, onError);\n\n function onError(err) {\n // Throw the original error, if it's one of our own (user-friendly) errors.\n // Otherwise, throw a generic, friendly error.\n if (err && !(err instanceof SyntaxError)) {\n reject(err);\n }\n else {\n reject(ono.syntax('Unable to resolve $ref pointer \"%s\"', file.url));\n }\n }\n });\n}\n\n/**\n * Parses the given file's contents, using the configured parser plugins.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves with the parsed file contents and the parser that was used.\n */\nfunction parseFile(file, options) {\n return new Promise(function(resolve, reject) {\n debug('Parsing %s', file.url);\n\n // Find the parsers that can read this file type.\n // If none of the parsers are an exact match for this file, then we'll try ALL of them.\n // This handles situations where the file IS a supported type, just with an unknown extension.\n var allParsers = plugins.all(options.parse);\n var filteredParsers = plugins.filter(allParsers, 'canParse', file);\n var parsers = filteredParsers.length > 0 ? filteredParsers : allParsers;\n\n // Run the parsers, in order, until one of them succeeds\n plugins.sort(parsers);\n plugins.run(parsers, 'parse', file)\n .then(onParsed, onError);\n\n function onParsed(parser) {\n if (!parser.plugin.allowEmpty && isEmpty(parser.result)) {\n reject(ono.syntax('Error parsing \"%s\" as %s. \\nParsed value is empty', file.url, parser.plugin.name));\n }\n else {\n resolve(parser);\n }\n }\n\n function onError(err) {\n if (err) {\n err = err instanceof Error ? err : new Error(err);\n reject(ono.syntax(err, 'Error parsing %s', file.url));\n }\n else {\n reject(ono.syntax('Unable to parse %s', file.url));\n }\n }\n });\n}\n\n/**\n * Determines whether the parsed value is \"empty\".\n *\n * @param {*} value\n * @returns {boolean}\n */\nfunction isEmpty(value) {\n return value === undefined ||\n (typeof value === 'object' && Object.keys(value).length === 0) ||\n (typeof value === 'string' && value.trim().length === 0) ||\n (Buffer.isBuffer(value) && value.length === 0);\n}\n", - "'use strict';\n\nvar BINARY_REGEXP = /\\.(jpeg|jpg|gif|png|bmp|ico)$/i;\n\nmodule.exports = {\n /**\n * The order that this parser will run, in relation to other parsers.\n *\n * @type {number}\n */\n order: 400,\n\n /**\n * Whether to allow \"empty\" files (zero bytes).\n *\n * @type {boolean}\n */\n allowEmpty: true,\n\n /**\n * Determines whether this parser can parse a given file reference.\n * Parsers that return true will be tried, in order, until one successfully parses the file.\n * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case\n * every parser will be tried.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @returns {boolean}\n */\n canParse: function isBinary(file) {\n // Use this parser if the file is a Buffer, and has a known binary extension\n return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url);\n },\n\n /**\n * Parses the given data as a Buffer (byte array).\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @returns {Promise}\n */\n parse: function parseBinary(file) {\n if (Buffer.isBuffer(file.data)) {\n return file.data;\n }\n else {\n // This will reject if data is anything other than a string or typed array\n return new Buffer(file.data);\n }\n }\n};\n", - "'use strict';\n\nvar Promise = require('../util/promise');\n\nmodule.exports = {\n /**\n * The order that this parser will run, in relation to other parsers.\n *\n * @type {number}\n */\n order: 100,\n\n /**\n * Whether to allow \"empty\" files. This includes zero-byte files, as well as empty JSON objects.\n *\n * @type {boolean}\n */\n allowEmpty: true,\n\n /**\n * Determines whether this parser can parse a given file reference.\n * Parsers that match will be tried, in order, until one successfully parses the file.\n * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case\n * every parser will be tried.\n *\n * @type {RegExp|string[]|function}\n */\n canParse: '.json',\n\n /**\n * Parses the given file as JSON\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @returns {Promise}\n */\n parse: function parseJSON(file) {\n return new Promise(function(resolve, reject) {\n var data = file.data;\n if (Buffer.isBuffer(data)) {\n data = data.toString();\n }\n\n if (typeof data === 'string') {\n if (data.trim().length === 0) {\n resolve(undefined); // This mirrors the YAML behavior\n }\n else {\n resolve(JSON.parse(data));\n }\n }\n else {\n // data is already a JavaScript value (object, array, number, null, NaN, etc.)\n resolve(data);\n }\n });\n }\n};\n", - "'use strict';\n\nvar TEXT_REGEXP = /\\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i;\n\nmodule.exports = {\n /**\n * The order that this parser will run, in relation to other parsers.\n *\n * @type {number}\n */\n order: 300,\n\n /**\n * Whether to allow \"empty\" files (zero bytes).\n *\n * @type {boolean}\n */\n allowEmpty: true,\n\n /**\n * The encoding that the text is expected to be in.\n *\n * @type {string}\n */\n encoding: 'utf8',\n\n /**\n * Determines whether this parser can parse a given file reference.\n * Parsers that return true will be tried, in order, until one successfully parses the file.\n * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case\n * every parser will be tried.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @returns {boolean}\n */\n canParse: function isText(file) {\n // Use this parser if the file is a string or Buffer, and has a known text-based extension\n return (typeof file.data === 'string' || Buffer.isBuffer(file.data)) && TEXT_REGEXP.test(file.url);\n },\n\n /**\n * Parses the given file as text\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @returns {Promise}\n */\n parse: function parseText(file) {\n if (typeof file.data === 'string') {\n return file.data;\n }\n else if (Buffer.isBuffer(file.data)) {\n return file.data.toString(this.encoding);\n }\n else {\n throw new Error('data is not text');\n }\n }\n};\n", - "'use strict';\n\nvar Promise = require('../util/promise'),\n YAML = require('../util/yaml');\n\nmodule.exports = {\n /**\n * The order that this parser will run, in relation to other parsers.\n *\n * @type {number}\n */\n order: 200,\n\n /**\n * Whether to allow \"empty\" files. This includes zero-byte files, as well as empty JSON objects.\n *\n * @type {boolean}\n */\n allowEmpty: true,\n\n /**\n * Determines whether this parser can parse a given file reference.\n * Parsers that match will be tried, in order, until one successfully parses the file.\n * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case\n * every parser will be tried.\n *\n * @type {RegExp|string[]|function}\n */\n canParse: ['.yaml', '.yml', '.json'], // JSON is valid YAML\n\n /**\n * Parses the given file as YAML\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver\n * @returns {Promise}\n */\n parse: function parseYAML(file) {\n return new Promise(function(resolve, reject) {\n var data = file.data;\n if (Buffer.isBuffer(data)) {\n data = data.toString();\n }\n\n if (typeof data === 'string') {\n resolve(YAML.parse(data));\n }\n else {\n // data is already a JavaScript value (object, array, number, null, NaN, etc.)\n resolve(data);\n }\n });\n }\n};\n", - "'use strict';\n\nmodule.exports = Pointer;\n\nvar $Ref = require('./ref'),\n url = require('./util/url'),\n ono = require('ono'),\n slashes = /\\//g,\n tildes = /~/g,\n escapedSlash = /~1/g,\n escapedTilde = /~0/g;\n\n/**\n * This class represents a single JSON pointer and its resolved value.\n *\n * @param {$Ref} $ref\n * @param {string} path\n * @constructor\n */\nfunction Pointer($ref, path) {\n /**\n * The {@link $Ref} object that contains this {@link Pointer} object.\n * @type {$Ref}\n */\n this.$ref = $ref;\n\n /**\n * The file path or URL, containing the JSON pointer in the hash.\n * This path is relative to the path of the main JSON schema file.\n * @type {string}\n */\n this.path = path;\n\n /**\n * The value of the JSON pointer.\n * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).\n * @type {?*}\n */\n this.value = undefined;\n\n /**\n * Indicates whether the pointer references itself.\n * @type {boolean}\n */\n this.circular = false;\n}\n\n/**\n * Resolves the value of a nested property within the given object.\n *\n * @param {*} obj - The object that will be crawled\n * @param {$RefParserOptions} options\n *\n * @returns {Pointer}\n * Returns a JSON pointer whose {@link Pointer#value} is the resolved value.\n * If resolving this value required resolving other JSON references, then\n * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path\n * of the resolved value.\n */\nPointer.prototype.resolve = function(obj, options) {\n var tokens = Pointer.parse(this.path);\n\n // Crawl the object, one token at a time\n this.value = obj;\n for (var i = 0; i < tokens.length; i++) {\n if (resolveIf$Ref(this, options)) {\n // The $ref path has changed, so append the remaining tokens to the path\n this.path = Pointer.join(this.path, tokens.slice(i));\n }\n\n var token = tokens[i];\n if (this.value[token] === undefined) {\n throw ono.syntax('Error resolving $ref pointer \"%s\". \\nToken \"%s\" does not exist.', this.path, token);\n }\n else {\n this.value = this.value[token];\n }\n }\n\n // Resolve the final value\n resolveIf$Ref(this, options);\n return this;\n};\n\n/**\n * Sets the value of a nested property within the given object.\n *\n * @param {*} obj - The object that will be crawled\n * @param {*} value - the value to assign\n * @param {$RefParserOptions} options\n *\n * @returns {*}\n * Returns the modified object, or an entirely new object if the entire object is overwritten.\n */\nPointer.prototype.set = function(obj, value, options) {\n var tokens = Pointer.parse(this.path);\n var token;\n\n if (tokens.length === 0) {\n // There are no tokens, replace the entire object with the new value\n this.value = value;\n return value;\n }\n\n // Crawl the object, one token at a time\n this.value = obj;\n for (var i = 0; i < tokens.length - 1; i++) {\n resolveIf$Ref(this, options);\n\n token = tokens[i];\n if (this.value && this.value[token] !== undefined) {\n // The token exists\n this.value = this.value[token];\n }\n else {\n // The token doesn't exist, so create it\n this.value = setValue(this, token, {});\n }\n }\n\n // Set the value of the final token\n resolveIf$Ref(this, options);\n token = tokens[tokens.length - 1];\n setValue(this, token, value);\n\n // Return the updated object\n return obj;\n};\n\n/**\n * Parses a JSON pointer (or a path containing a JSON pointer in the hash)\n * and returns an array of the pointer's tokens.\n * (e.g. \"schema.json#/definitions/person/name\" => [\"definitions\", \"person\", \"name\"])\n *\n * The pointer is parsed according to RFC 6901\n * {@link https://tools.ietf.org/html/rfc6901#section-3}\n *\n * @param {string} path\n * @returns {string[]}\n */\nPointer.parse = function(path) {\n // Get the JSON pointer from the path's hash\n var pointer = url.getHash(path).substr(1);\n\n // If there's no pointer, then there are no tokens,\n // so return an empty array\n if (!pointer) {\n return [];\n }\n\n // Split into an array\n pointer = pointer.split('/');\n\n // Decode each part, according to RFC 6901\n for (var i = 0; i < pointer.length; i++) {\n pointer[i] = decodeURI(pointer[i].replace(escapedSlash, '/').replace(escapedTilde, '~'));\n }\n\n if (pointer[0] !== '') {\n throw ono.syntax('Invalid $ref pointer \"%s\". Pointers must begin with \"#/\"', pointer);\n }\n\n return pointer.slice(1);\n};\n\n/**\n * Creates a JSON pointer path, by joining one or more tokens to a base path.\n *\n * @param {string} base - The base path (e.g. \"schema.json#/definitions/person\")\n * @param {string|string[]} tokens - The token(s) to append (e.g. [\"name\", \"first\"])\n * @returns {string}\n */\nPointer.join = function(base, tokens) {\n // Ensure that the base path contains a hash\n if (base.indexOf('#') === -1) {\n base += '#';\n }\n\n // Append each token to the base path\n tokens = Array.isArray(tokens) ? tokens : [tokens];\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n // Encode the token, according to RFC 6901\n base += '/' + encodeURI(token.replace(tildes, '~0').replace(slashes, '~1'));\n }\n\n return base;\n};\n\n/**\n * If the given pointer's {@link Pointer#value} is a JSON reference,\n * then the reference is resolved and {@link Pointer#value} is replaced with the resolved value.\n * In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the\n * resolution path of the new value.\n *\n * @param {Pointer} pointer\n * @param {$RefParserOptions} options\n * @returns {boolean} - Returns `true` if the resolution path changed\n */\nfunction resolveIf$Ref(pointer, options) {\n // Is the value a JSON reference? (and allowed?)\n\n if ($Ref.isAllowed$Ref(pointer.value, options)) {\n var $refPath = url.resolve(pointer.path, pointer.value.$ref);\n\n if ($refPath === pointer.path) {\n // The value is a reference to itself, so there's nothing to do.\n pointer.circular = true;\n }\n else {\n var resolved = pointer.$ref.$refs._resolve($refPath, options);\n\n if ($Ref.isExtended$Ref(pointer.value)) {\n // This JSON reference \"extends\" the resolved value, rather than simply pointing to it.\n // So the resolved path does NOT change. Just the value does.\n pointer.value = $Ref.dereference(pointer.value, resolved.value);\n }\n else {\n // Resolve the reference\n pointer.$ref = resolved.$ref;\n pointer.path = resolved.path;\n pointer.value = resolved.value;\n }\n\n return true;\n }\n }\n}\n\n/**\n * Sets the specified token value of the {@link Pointer#value}.\n *\n * The token is evaluated according to RFC 6901.\n * {@link https://tools.ietf.org/html/rfc6901#section-4}\n *\n * @param {Pointer} pointer - The JSON Pointer whose value will be modified\n * @param {string} token - A JSON Pointer token that indicates how to modify `obj`\n * @param {*} value - The value to assign\n * @returns {*} - Returns the assigned value\n */\nfunction setValue(pointer, token, value) {\n if (pointer.value && typeof pointer.value === 'object') {\n if (token === '-' && Array.isArray(pointer.value)) {\n pointer.value.push(value);\n }\n else {\n pointer.value[token] = value;\n }\n }\n else {\n throw ono.syntax('Error assigning $ref pointer \"%s\". \\nCannot set \"%s\" of a non-object.', pointer.path, token);\n }\n return value;\n}\n", - "'use strict';\n\nmodule.exports = $Ref;\n\nvar Pointer = require('./pointer');\n\n/**\n * This class represents a single JSON reference and its resolved value.\n *\n * @constructor\n */\nfunction $Ref() {\n /**\n * The file path or URL of the referenced file.\n * This path is relative to the path of the main JSON schema file.\n *\n * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file.\n * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get\n * specific JSON pointers within the file.\n *\n * @type {string}\n */\n this.path = undefined;\n\n /**\n * The resolved value of the JSON reference.\n * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).\n * @type {?*}\n */\n this.value = undefined;\n\n /**\n * The {@link $Refs} object that contains this {@link $Ref} object.\n * @type {$Refs}\n */\n this.$refs = undefined;\n\n /**\n * Indicates the type of {@link $Ref#path} (e.g. \"file\", \"http\", etc.)\n * @type {?string}\n */\n this.pathType = undefined;\n}\n\n/**\n * Determines whether the given JSON reference exists within this {@link $Ref#value}.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {boolean}\n */\n$Ref.prototype.exists = function(path, options) {\n try {\n this.resolve(path, options);\n return true;\n }\n catch (e) {\n return false;\n }\n};\n\n/**\n * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {*} - Returns the resolved value\n */\n$Ref.prototype.get = function(path, options) {\n return this.resolve(path, options).value;\n};\n\n/**\n * Resolves the given JSON reference within this {@link $Ref#value}.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {Pointer}\n */\n$Ref.prototype.resolve = function(path, options) {\n var pointer = new Pointer(this, path);\n return pointer.resolve(this.value, options);\n};\n\n/**\n * Sets the value of a nested property within this {@link $Ref#value}.\n * If the property, or any of its parents don't exist, they will be created.\n *\n * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash\n * @param {*} value - The value to assign\n */\n$Ref.prototype.set = function(path, value) {\n var pointer = new Pointer(this, path);\n this.value = pointer.set(this.value, value);\n};\n\n/**\n * Determines whether the given value is a JSON reference.\n *\n * @param {*} value - The value to inspect\n * @returns {boolean}\n */\n$Ref.is$Ref = function(value) {\n return value && typeof value === 'object' && typeof value.$ref === 'string' && value.$ref.length > 0;\n};\n\n/**\n * Determines whether the given value is an external JSON reference.\n *\n * @param {*} value - The value to inspect\n * @returns {boolean}\n */\n$Ref.isExternal$Ref = function(value) {\n return $Ref.is$Ref(value) && value.$ref[0] !== '#';\n};\n\n/**\n * Determines whether the given value is a JSON reference, and whether it is allowed by the options.\n * For example, if it references an external file, then options.resolve.external must be true.\n *\n * @param {*} value - The value to inspect\n * @param {$RefParserOptions} options\n * @returns {boolean}\n */\n$Ref.isAllowed$Ref = function(value, options) {\n if ($Ref.is$Ref(value)) {\n if (value.$ref[0] === '#' || !options || options.resolve.external) {\n return true;\n }\n }\n};\n\n/**\n * Determines whether the given value is a JSON reference that \"extends\" its resolved value.\n * That is, it has extra properties (in addition to \"$ref\"), so rather than simply pointing to\n * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved\n * value, plus the extra properties.\n *\n * @example:\n * {\n * person: {\n * properties: {\n * firstName: { type: string }\n * lastName: { type: string }\n * }\n * }\n * employee: {\n * properties: {\n * $ref: #/person/properties\n * salary: { type: number }\n * }\n * }\n * }\n *\n * In this example, \"employee\" is an extended $ref, since it extends \"person\" with an additional\n * property (salary). The result is a NEW value that looks like this:\n *\n * {\n * properties: {\n * firstName: { type: string }\n * lastName: { type: string }\n * salary: { type: number }\n * }\n * }\n *\n * @param {*} value - The value to inspect\n * @returns {boolean}\n */\n$Ref.isExtended$Ref = function(value) {\n return $Ref.is$Ref(value) && Object.keys(value).length > 1;\n};\n\n/**\n * Returns the resolved value of a JSON Reference.\n * If necessary, the resolved value is merged with the JSON Reference to create a new object\n *\n * @example:\n * {\n * person: {\n * properties: {\n * firstName: { type: string }\n * lastName: { type: string }\n * }\n * }\n * employee: {\n * properties: {\n * $ref: #/person/properties\n * salary: { type: number }\n * }\n * }\n * }\n *\n * When \"person\" and \"employee\" are merged, you end up with the following object:\n *\n * {\n * properties: {\n * firstName: { type: string }\n * lastName: { type: string }\n * salary: { type: number }\n * }\n * }\n *\n * @param {object} $ref - The JSON reference object (the one with the \"$ref\" property)\n * @param {*} resolvedValue - The resolved value, which can be any type\n * @returns {*} - Returns the dereferenced value\n */\n$Ref.dereference = function($ref, resolvedValue) {\n if (resolvedValue && typeof resolvedValue === 'object' && $Ref.isExtended$Ref($ref)) {\n var merged = {};\n Object.keys($ref).forEach(function(key) {\n if (key !== '$ref') {\n merged[key] = $ref[key];\n }\n });\n Object.keys(resolvedValue).forEach(function(key) {\n if (!(key in merged)) {\n merged[key] = resolvedValue[key];\n }\n });\n return merged;\n }\n else {\n // Completely replace the original reference with the resolved value\n return resolvedValue;\n }\n};\n", - "'use strict';\n\nvar ono = require('ono'),\n $Ref = require('./ref'),\n url = require('./util/url');\n\nmodule.exports = $Refs;\n\n/**\n * This class is a map of JSON references and their resolved values.\n */\nfunction $Refs() {\n /**\n * Indicates whether the schema contains any circular references.\n *\n * @type {boolean}\n */\n this.circular = false;\n\n /**\n * A map of paths/urls to {@link $Ref} objects\n *\n * @type {object}\n * @protected\n */\n this._$refs = {};\n\n /**\n * The {@link $Ref} object that is the root of the JSON schema.\n *\n * @type {$Ref}\n * @protected\n */\n this._root$Ref = null;\n}\n\n/**\n * Returns the paths of all the files/URLs that are referenced by the JSON schema,\n * including the schema itself.\n *\n * @param {...string|string[]} [types] - Only return paths of the given types (\"file\", \"http\", etc.)\n * @returns {string[]}\n */\n$Refs.prototype.paths = function(types) {\n var paths = getPaths(this._$refs, arguments);\n return paths.map(function(path) {\n return path.decoded;\n });\n};\n\n/**\n * Returns the map of JSON references and their resolved values.\n *\n * @param {...string|string[]} [types] - Only return references of the given types (\"file\", \"http\", etc.)\n * @returns {object}\n */\n$Refs.prototype.values = function(types) {\n var $refs = this._$refs;\n var paths = getPaths($refs, arguments);\n return paths.reduce(function(obj, path) {\n obj[path.decoded] = $refs[path.encoded].value;\n return obj;\n }, {});\n};\n\n/**\n * Returns a POJO (plain old JavaScript object) for serialization as JSON.\n *\n * @returns {object}\n */\n$Refs.prototype.toJSON = $Refs.prototype.values;\n\n/**\n * Determines whether the given JSON reference exists.\n *\n * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} [options]\n * @returns {boolean}\n */\n$Refs.prototype.exists = function(path, options) {\n try {\n this._resolve(path, options);\n return true;\n }\n catch (e) {\n return false;\n }\n};\n\n/**\n * Resolves the given JSON reference and returns the resolved value.\n *\n * @param {string} path - The path being resolved, with a JSON pointer in the hash\n * @param {$RefParserOptions} [options]\n * @returns {*} - Returns the resolved value\n */\n$Refs.prototype.get = function(path, options) {\n return this._resolve(path, options).value;\n};\n\n/**\n * Sets the value of a nested property within this {@link $Ref#value}.\n * If the property, or any of its parents don't exist, they will be created.\n *\n * @param {string} path - The path of the property to set, optionally with a JSON pointer in the hash\n * @param {*} value - The value to assign\n */\n$Refs.prototype.set = function(path, value) {\n path = url.resolve(this._root$Ref.path, path);\n var withoutHash = url.stripHash(path);\n var $ref = this._$refs[withoutHash];\n\n if (!$ref) {\n throw ono('Error resolving $ref pointer \"%s\". \\n\"%s\" not found.', path, withoutHash);\n }\n\n $ref.set(path, value);\n};\n\n/**\n * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.\n *\n * @param {string} path - The file path or URL of the referenced file\n * @param {*} [value] - Optional. The value of the $ref.\n */\n$Refs.prototype._add = function(path, value) {\n var withoutHash = url.stripHash(path);\n\n var $ref = new $Ref();\n $ref.path = withoutHash;\n $ref.value = value;\n $ref.$refs = this;\n\n this._$refs[withoutHash] = $ref;\n this._root$Ref = this._root$Ref || $ref;\n\n return $ref;\n};\n\n/**\n * Resolves the given JSON reference.\n *\n * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} [options]\n * @returns {Pointer}\n * @protected\n */\n$Refs.prototype._resolve = function(path, options) {\n path = url.resolve(this._root$Ref.path, path);\n var withoutHash = url.stripHash(path);\n var $ref = this._$refs[withoutHash];\n\n if (!$ref) {\n throw ono('Error resolving $ref pointer \"%s\". \\n\"%s\" not found.', path, withoutHash);\n }\n\n return $ref.resolve(path, options);\n};\n\n/**\n * Returns the specified {@link $Ref} object, or undefined.\n *\n * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash\n * @returns {$Ref|undefined}\n * @protected\n */\n$Refs.prototype._get$Ref = function(path) {\n path = url.resolve(this._root$Ref.path, path);\n var withoutHash = url.stripHash(path);\n return this._$refs[withoutHash];\n};\n\n/**\n * Returns the encoded and decoded paths keys of the given object.\n *\n * @param {object} $refs - The object whose keys are URL-encoded paths\n * @param {...string|string[]} [types] - Only return paths of the given types (\"file\", \"http\", etc.)\n * @returns {object[]}\n */\nfunction getPaths($refs, types) {\n var paths = Object.keys($refs);\n\n // Filter the paths by type\n types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types);\n if (types.length > 0 && types[0]) {\n paths = paths.filter(function(key) {\n return types.indexOf($refs[key].pathType) !== -1;\n });\n }\n\n // Decode local filesystem paths\n return paths.map(function(path) {\n return {\n encoded: path,\n decoded: $refs[path].pathType === 'file' ? url.toFileSystemPath(path, true) : path\n };\n });\n}\n", - "'use strict';\n\nvar Promise = require('./util/promise'),\n $Ref = require('./ref'),\n Pointer = require('./pointer'),\n parse = require('./parse'),\n debug = require('./util/debug'),\n url = require('./util/url');\n\nmodule.exports = resolve;\n\n/**\n * Crawls the JSON schema, finds all external JSON references, and resolves their values.\n * This method does not mutate the JSON schema. The resolved values are added to {@link $RefParser#$refs}.\n *\n * NOTE: We only care about EXTERNAL references here. INTERNAL references are only relevant when dereferencing.\n *\n * @param {$RefParser} parser\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves once all JSON references in the schema have been resolved,\n * including nested references that are contained in externally-referenced files.\n */\nfunction resolve(parser, options) {\n if (!options.resolve.external) {\n // Nothing to resolve, so exit early\n return Promise.resolve();\n }\n\n try {\n debug('Resolving $ref pointers in %s', parser.$refs._root$Ref.path);\n var promises = crawl(parser.schema, parser.$refs._root$Ref.path + '#', parser.$refs, options);\n return Promise.all(promises);\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Recursively crawls the given value, and resolves any external JSON references.\n *\n * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored.\n * @param {string} path - The full path of `obj`, possibly with a JSON Pointer in the hash\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n *\n * @returns {Promise[]}\n * Returns an array of promises. There will be one promise for each JSON reference in `obj`.\n * If `obj` does not contain any JSON references, then the array will be empty.\n * If any of the JSON references point to files that contain additional JSON references,\n * then the corresponding promise will internally reference an array of promises.\n */\nfunction crawl(obj, path, $refs, options) {\n var promises = [];\n\n if (obj && typeof obj === 'object') {\n if ($Ref.isExternal$Ref(obj)) {\n promises.push(resolve$Ref(obj, path, $refs, options));\n }\n else {\n Object.keys(obj).forEach(function(key) {\n var keyPath = Pointer.join(path, key);\n var value = obj[key];\n\n if ($Ref.isExternal$Ref(value)) {\n promises.push(resolve$Ref(value, keyPath, $refs, options));\n }\n else {\n promises = promises.concat(crawl(value, keyPath, $refs, options));\n }\n });\n }\n }\n\n return promises;\n}\n\n/**\n * Resolves the given JSON Reference, and then crawls the resulting value.\n *\n * @param {{$ref: string}} $ref - The JSON Reference to resolve\n * @param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves once all JSON references in the object have been resolved,\n * including nested references that are contained in externally-referenced files.\n */\nfunction resolve$Ref($ref, path, $refs, options) {\n debug('Resolving $ref pointer \"%s\" at %s', $ref.$ref, path);\n\n var resolvedPath = url.resolve(path, $ref.$ref);\n var withoutHash = url.stripHash(resolvedPath);\n\n // Do we already have this $ref?\n $ref = $refs._get$Ref(withoutHash);\n if ($ref) {\n // We've already parsed this $ref, so use the existing value\n return Promise.resolve($ref.value);\n }\n\n // Parse the $referenced file/url\n return parse(resolvedPath, $refs, options)\n .then(function(result) {\n // Crawl the parsed value\n debug('Resolving $ref pointers in %s', withoutHash);\n var promises = crawl(result, withoutHash + '#', $refs, options);\n return Promise.all(promises);\n });\n}\n", - "'use strict';\nvar fs = require('fs'),\n ono = require('ono'),\n Promise = require('../util/promise'),\n url = require('../util/url'),\n debug = require('../util/debug');\n\nmodule.exports = {\n /**\n * The order that this resolver will run, in relation to other resolvers.\n *\n * @type {number}\n */\n order: 100,\n\n /**\n * Determines whether this resolver can read a given file reference.\n * Resolvers that return true will be tried, in order, until one successfully resolves the file.\n * Resolvers that return false will not be given a chance to resolve the file.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @returns {boolean}\n */\n canRead: function isFile(file) {\n return url.isFileSystemPath(file.url);\n },\n\n /**\n * Reads the given file and returns its raw contents as a Buffer.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @returns {Promise}\n */\n read: function readFile(file) {\n return new Promise(function(resolve, reject) {\n var path;\n try {\n path = url.toFileSystemPath(file.url);\n }\n catch (err) {\n reject(ono.uri(err, 'Malformed URI: %s', file.url));\n }\n\n debug('Opening file: %s', path);\n\n try {\n fs.readFile(path, function(err, data) {\n if (err) {\n reject(ono(err, 'Error opening file \"%s\"', path));\n }\n else {\n resolve(data);\n }\n });\n }\n catch (err) {\n reject(ono(err, 'Error opening file \"%s\"', path));\n }\n });\n }\n};\n", - "'use strict';\n\nvar http = require('http'),\n https = require('https'),\n ono = require('ono'),\n url = require('../util/url'),\n debug = require('../util/debug'),\n Promise = require('../util/promise');\n\nmodule.exports = {\n /**\n * The order that this resolver will run, in relation to other resolvers.\n *\n * @type {number}\n */\n order: 200,\n\n /**\n * HTTP headers to send when downloading files.\n *\n * @example:\n * {\n * \"User-Agent\": \"JSON Schema $Ref Parser\",\n * Accept: \"application/json\"\n * }\n *\n * @type {object}\n */\n headers: null,\n\n /**\n * HTTP request timeout (in milliseconds).\n *\n * @type {number}\n */\n timeout: 5000, // 5 seconds\n\n /**\n * The maximum number of HTTP redirects to follow.\n * To disable automatic following of redirects, set this to zero.\n *\n * @type {number}\n */\n redirects: 5,\n\n /**\n * The `withCredentials` option of XMLHttpRequest.\n * Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication\n *\n * @type {boolean}\n */\n withCredentials: false,\n\n /**\n * Determines whether this resolver can read a given file reference.\n * Resolvers that return true will be tried in order, until one successfully resolves the file.\n * Resolvers that return false will not be given a chance to resolve the file.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @returns {boolean}\n */\n canRead: function isHttp(file) {\n return url.isHttp(file.url);\n },\n\n /**\n * Reads the given URL and returns its raw contents as a Buffer.\n *\n * @param {object} file - An object containing information about the referenced file\n * @param {string} file.url - The full URL of the referenced file\n * @param {string} file.extension - The lowercased file extension (e.g. \".txt\", \".html\", etc.)\n * @returns {Promise}\n */\n read: function readHttp(file) {\n var u = url.parse(file.url);\n\n if (process.browser && !u.protocol) {\n // Use the protocol of the current page\n u.protocol = url.parse(location.href).protocol;\n }\n\n return download(u, this);\n }\n};\n\n/**\n * Downloads the given file.\n *\n * @param {Url|string} u - The url to download (can be a parsed {@link Url} object)\n * @param {object} httpOptions - The `options.resolve.http` object\n * @param {number} [redirects] - The redirect URLs that have already been followed\n *\n * @returns {Promise}\n * The promise resolves with the raw downloaded data, or rejects if there is an HTTP error.\n */\nfunction download(u, httpOptions, redirects) {\n return new Promise(function(resolve, reject) {\n u = url.parse(u);\n redirects = redirects || [];\n redirects.push(u.href);\n\n get(u, httpOptions)\n .then(function(res) {\n if (res.statusCode >= 400) {\n throw ono({status: res.statusCode}, 'HTTP ERROR %d', res.statusCode);\n }\n else if (res.statusCode >= 300) {\n if (redirects.length > httpOptions.redirects) {\n reject(ono({status: res.statusCode}, 'Error downloading %s. \\nToo many redirects: \\n %s',\n redirects[0], redirects.join(' \\n ')));\n }\n else if (!res.headers.location) {\n throw ono({status: res.statusCode}, 'HTTP %d redirect with no location header', res.statusCode);\n }\n else {\n debug('HTTP %d redirect %s -> %s', res.statusCode, u.href, res.headers.location);\n var redirectTo = url.resolve(u, res.headers.location);\n download(redirectTo, httpOptions, redirects).then(resolve, reject);\n }\n }\n else {\n resolve(res.body || new Buffer(0));\n }\n })\n .catch(function(err) {\n reject(ono(err, 'Error downloading', u.href));\n });\n });\n}\n\n/**\n * Sends an HTTP GET request.\n *\n * @param {Url} u - A parsed {@link Url} object\n * @param {object} httpOptions - The `options.resolve.http` object\n *\n * @returns {Promise}\n * The promise resolves with the HTTP Response object.\n */\nfunction get(u, httpOptions) {\n return new Promise(function(resolve, reject) {\n debug('GET', u.href);\n\n var protocol = u.protocol === 'https:' ? https : http;\n var req = protocol.get({\n hostname: u.hostname,\n port: u.port,\n path: u.path,\n auth: u.auth,\n headers: httpOptions.headers || {},\n withCredentials: httpOptions.withCredentials\n });\n\n if (typeof req.setTimeout === 'function') {\n req.setTimeout(httpOptions.timeout);\n }\n\n req.on('timeout', function() {\n req.abort();\n });\n\n req.on('error', reject);\n\n req.once('response', function(res) {\n res.body = new Buffer(0);\n\n res.on('data', function(data) {\n res.body = Buffer.concat([res.body, new Buffer(data)]);\n });\n\n res.on('error', reject);\n\n res.on('end', function() {\n resolve(res);\n });\n });\n });\n}\n", - "'use strict';\n\nvar debug = require('debug');\n\n/**\n * Writes messages to stdout.\n * Log messages are suppressed by default, but can be enabled by setting the DEBUG variable.\n * @type {function}\n */\nmodule.exports = debug('json-schema-ref-parser');\n", - "'use strict';\n\nvar Promise = require('./promise'),\n debug = require('./debug');\n\n/**\n * Returns the given plugins as an array, rather than an object map.\n * All other methods in this module expect an array of plugins rather than an object map.\n *\n * @param {object} plugins - A map of plugin objects\n * @return {object[]}\n */\nexports.all = function(plugins) {\n return Object.keys(plugins)\n .filter(function(key) {\n return typeof plugins[key] === 'object';\n })\n .map(function(key) {\n plugins[key].name = key;\n return plugins[key];\n });\n};\n\n/**\n * Filters the given plugins, returning only the ones return `true` for the given method.\n *\n * @param {object[]} plugins - An array of plugin objects\n * @param {string} method - The name of the filter method to invoke for each plugin\n * @param {object} file - A file info object, which will be passed to each method\n * @return {object[]}\n */\nexports.filter = function(plugins, method, file) {\n return plugins\n .filter(function(plugin) {\n return !!getResult(plugin, method, file);\n });\n};\n\n/**\n * Sorts the given plugins, in place, by their `order` property.\n *\n * @param {object[]} plugins - An array of plugin objects\n * @returns {object[]}\n */\nexports.sort = function(plugins) {\n plugins.forEach(function(plugin) {\n plugin.order = plugin.order || Number.MAX_SAFE_INTEGER;\n });\n\n return plugins.sort(function(a, b) { return a.order - b.order; });\n};\n\n/**\n * Runs the specified method of the given plugins, in order, until one of them returns a successful result.\n * Each method can return a synchronous value, a Promise, or call an error-first callback.\n * If the promise resolves successfully, or the callback is called without an error, then the result\n * is immediately returned and no further plugins are called.\n * If the promise rejects, or the callback is called with an error, then the next plugin is called.\n * If ALL plugins fail, then the last error is thrown.\n *\n * @param {object[]} plugins - An array of plugin objects\n * @param {string} method - The name of the method to invoke for each plugin\n * @param {object} file - A file info object, which will be passed to each method\n * @returns {Promise}\n */\nexports.run = function(plugins, method, file) {\n var plugin, lastError, index = 0;\n\n return new Promise(function(resolve, reject) {\n runNextPlugin();\n\n function runNextPlugin() {\n plugin = plugins[index++];\n if (!plugin) {\n // There are no more functions, so re-throw the last error\n return reject(lastError);\n }\n\n try {\n debug(' %s', plugin.name);\n var result = getResult(plugin, method, file, callback);\n if (result && typeof result.then === 'function') {\n // A promise was returned\n result.then(onSuccess, onError);\n }\n else if (result !== undefined) {\n // A synchronous result was returned\n onSuccess(result);\n }\n // else { the callback will be called }\n }\n catch (e) {\n onError(e);\n }\n }\n\n function callback(err, result) {\n if (err) {\n onError(err);\n }\n else {\n onSuccess(result);\n }\n }\n\n function onSuccess(result) {\n debug(' success');\n resolve({\n plugin: plugin,\n result: result\n });\n }\n\n function onError(err) {\n debug(' %s', err.message || err);\n lastError = err;\n runNextPlugin();\n }\n });\n};\n\n/**\n * Returns the value of the given property.\n * If the property is a function, then the result of the function is returned.\n * If the value is a RegExp, then it will be tested against the file URL.\n * If the value is an aray, then it will be compared against the file extension.\n *\n * @param {object} obj - The object whose property/method is called\n * @param {string} prop - The name of the property/method to invoke\n * @param {object} file - A file info object, which will be passed to the method\n * @param {function} [callback] - A callback function, which will be passed to the method\n * @returns {*}\n */\nfunction getResult(obj, prop, file, callback) {\n var value = obj[prop];\n\n if (typeof value === 'function') {\n return value.apply(obj, [file, callback]);\n }\n\n if (!callback) {\n // The synchronous plugin functions (canParse and canRead)\n // allow a \"shorthand\" syntax, where the user can match\n // files by RegExp or by file extension.\n if (value instanceof RegExp) {\n return value.test(file.url);\n }\n else if (typeof value === 'string') {\n return value === file.extension;\n }\n else if (Array.isArray(value)) {\n return value.indexOf(file.extension) !== -1;\n }\n }\n\n return value;\n}\n", - "'use strict';\n\nvar isWindows = /^win/.test(process.platform),\n forwardSlashPattern = /\\//g,\n protocolPattern = /^([a-z0-9.+-]+):\\/\\//i,\n url = module.exports;\n\n// RegExp patterns to URL-encode special characters in local filesystem paths\nvar urlEncodePatterns = [\n /\\?/g, '%3F',\n /\\#/g, '%23',\n isWindows ? /\\\\/g : /\\//, '/'\n];\n\n// RegExp patterns to URL-decode special characters for local filesystem paths\nvar urlDecodePatterns = [\n /\\%23/g, '#',\n /\\%24/g, '$',\n /\\%26/g, '&',\n /\\%2C/g, ',',\n /\\%40/g, '@'\n];\n\nexports.parse = require('url').parse;\nexports.resolve = require('url').resolve;\n\n/**\n * Returns the current working directory (in Node) or the current page URL (in browsers).\n *\n * @returns {string}\n */\nexports.cwd = function cwd() {\n return process.browser ? location.href : process.cwd() + '/';\n};\n\n/**\n * Returns the protocol of the given URL, or `undefined` if it has no protocol.\n *\n * @param {string} path\n * @returns {?string}\n */\nexports.getProtocol = function getProtocol(path) {\n var match = protocolPattern.exec(path);\n if (match) {\n return match[1].toLowerCase();\n }\n};\n\n/**\n * Returns the lowercased file extension of the given URL,\n * or an empty string if it has no extension.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.getExtension = function getExtension(path) {\n var lastDot = path.lastIndexOf('.');\n if (lastDot >= 0) {\n return path.substr(lastDot).toLowerCase();\n }\n return '';\n};\n\n/**\n * Returns the hash (URL fragment), of the given path.\n * If there is no hash, then the root hash (\"#\") is returned.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.getHash = function getHash(path) {\n var hashIndex = path.indexOf('#');\n if (hashIndex >= 0) {\n return path.substr(hashIndex);\n }\n return '#';\n};\n\n/**\n * Removes the hash (URL fragment), if any, from the given path.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.stripHash = function stripHash(path) {\n var hashIndex = path.indexOf('#');\n if (hashIndex >= 0) {\n path = path.substr(0, hashIndex);\n }\n return path;\n};\n\n/**\n * Determines whether the given path is an HTTP(S) URL.\n *\n * @param {string} path\n * @returns {boolean}\n */\nexports.isHttp = function isHttp(path) {\n var protocol = url.getProtocol(path);\n if (protocol === 'http' || protocol === 'https') {\n return true;\n }\n else if (protocol === undefined) {\n // There is no protocol. If we're running in a browser, then assume it's HTTP.\n return process.browser;\n }\n else {\n // It's some other protocol, such as \"ftp://\", \"mongodb://\", etc.\n return false;\n }\n};\n\n/**\n * Determines whether the given path is a filesystem path.\n * This includes \"file://\" URLs.\n *\n * @param {string} path\n * @returns {boolean}\n */\nexports.isFileSystemPath = function isFileSystemPath(path) {\n if (process.browser) {\n // We're running in a browser, so assume that all paths are URLs.\n // This way, even relative paths will be treated as URLs rather than as filesystem paths\n return false;\n }\n\n var protocol = url.getProtocol(path);\n return protocol === undefined || protocol === 'file';\n};\n\n/**\n * Converts a filesystem path to a properly-encoded URL.\n *\n * This is intended to handle situations where JSON Schema $Ref Parser is called\n * with a filesystem path that contains characters which are not allowed in URLs.\n *\n * @example\n * The following filesystem paths would be converted to the following URLs:\n *\n * <\"!@#$%^&*+=?'>.json ==> %3C%22!@%23$%25%5E&*+=%3F\\'%3E.json\n * C:\\\\My Documents\\\\File (1).json ==> C:/My%20Documents/File%20(1).json\n * file://Project #42/file.json ==> file://Project%20%2342/file.json\n *\n * @param {string} path\n * @returns {string}\n */\nexports.fromFileSystemPath = function fromFileSystemPath(path) {\n // Step 1: Manually encode characters that are not encoded by `encodeURI`.\n // This includes characters such as \"#\" and \"?\", which have special meaning in URLs,\n // but are just normal characters in a filesystem path.\n // On Windows, this will also replace backslashes with forward slashes,\n // rather than encoding them as special characters.\n for (var i = 0; i < urlEncodePatterns.length; i += 2) {\n path = path.replace(urlEncodePatterns[i], urlEncodePatterns[i + 1]);\n }\n\n // Step 2: `encodeURI` will take care of all other characters\n return encodeURI(path);\n};\n\n/**\n * Converts a URL to a local filesystem path.\n *\n * @param {string} path\n * @param {boolean} [keepFileProtocol] - If true, then \"file://\" will NOT be stripped\n * @returns {string}\n */\nexports.toFileSystemPath = function toFileSystemPath(path, keepFileProtocol) {\n // Step 1: `decodeURI` will decode characters such as Cyrillic characters, spaces, etc.\n path = decodeURI(path);\n\n // Step 2: Manually decode characters that are not decoded by `decodeURI`.\n // This includes characters such as \"#\" and \"?\", which have special meaning in URLs,\n // but are just normal characters in a filesystem path.\n for (var i = 0; i < urlDecodePatterns.length; i += 2) {\n path = path.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);\n }\n\n // Step 3: If it's a \"file://\" URL, then format it consistently\n // or convert it to a local filesystem path\n var isFileUrl = path.substr(0, 7).toLowerCase() === 'file://';\n if (isFileUrl) {\n // Strip-off the protocol, and the initial \"/\", if there is one\n path = path[7] === '/' ? path.substr(8) : path.substr(7);\n\n // insert a colon (\":\") after the drive letter on Windows\n if (isWindows && path[1] === '/') {\n path = path[0] + ':' + path.substr(1);\n }\n\n if (keepFileProtocol) {\n // Return the consistently-formatted \"file://\" URL\n path = 'file:///' + path;\n }\n else {\n // Convert the \"file://\" URL to a local filesystem path.\n // On Windows, it will start with something like \"C:/\".\n // On Posix, it will start with \"/\"\n isFileUrl = false;\n path = isWindows ? path : '/' + path;\n }\n }\n\n // Step 4: On Windows, convert backslashes to forward slashes,\n // unless it's a \"file://\" URL\n if (isWindows && !isFileUrl) {\n path = path.replace(forwardSlashPattern, '\\\\');\n }\n\n return path;\n};\n", + "'use strict';\n\nvar YAMLException = require('./exception');\n\nvar TYPE_CONSTRUCTOR_OPTIONS = [\n 'kind',\n 'resolve',\n 'construct',\n 'instanceOf',\n 'predicate',\n 'represent',\n 'defaultStyle',\n 'styleAliases'\n];\n\nvar YAML_NODE_KINDS = [\n 'scalar',\n 'sequence',\n 'mapping'\n];\n\nfunction compileStyleAliases(map) {\n var result = {};\n\n if (null !== map) {\n Object.keys(map).forEach(function (style) {\n map[style].forEach(function (alias) {\n result[String(alias)] = style;\n });\n });\n }\n\n return result;\n}\n\nfunction Type(tag, options) {\n options = options || {};\n\n Object.keys(options).forEach(function (name) {\n if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {\n throw new YAMLException('Unknown option \"' + name + '\" is met in definition of \"' + tag + '\" YAML type.');\n }\n });\n\n // TODO: Add tag format check.\n this.tag = tag;\n this.kind = options['kind'] || null;\n this.resolve = options['resolve'] || function () { return true; };\n this.construct = options['construct'] || function (data) { return data; };\n this.instanceOf = options['instanceOf'] || null;\n this.predicate = options['predicate'] || null;\n this.represent = options['represent'] || null;\n this.defaultStyle = options['defaultStyle'] || null;\n this.styleAliases = compileStyleAliases(options['styleAliases'] || null);\n\n if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {\n throw new YAMLException('Unknown kind \"' + this.kind + '\" is specified for \"' + tag + '\" YAML type.');\n }\n}\n\nmodule.exports = Type;\n", + "'use strict';\n\n/*eslint-disable no-bitwise*/\n\n// A trick for browserified version.\n// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined\nvar NodeBuffer = require('buffer').Buffer;\nvar Type = require('../type');\n\n\n// [ 64, 65, 66 ] -> [ padding, CR, LF ]\nvar BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\\n\\r';\n\n\nfunction resolveYamlBinary(data) {\n if (null === data) {\n return false;\n }\n\n var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;\n\n // Convert one by one.\n for (idx = 0; idx < max; idx++) {\n code = map.indexOf(data.charAt(idx));\n\n // Skip CR/LF\n if (code > 64) { continue; }\n\n // Fail on illegal characters\n if (code < 0) { return false; }\n\n bitlen += 6;\n }\n\n // If there are any bits left, source was corrupted\n return (bitlen % 8) === 0;\n}\n\nfunction constructYamlBinary(data) {\n var idx, tailbits,\n input = data.replace(/[\\r\\n=]/g, ''), // remove CR/LF & padding to simplify scan\n max = input.length,\n map = BASE64_MAP,\n bits = 0,\n result = [];\n\n // Collect by 6*4 bits (3 bytes)\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 4 === 0) && idx) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n }\n\n bits = (bits << 6) | map.indexOf(input.charAt(idx));\n }\n\n // Dump tail\n\n tailbits = (max % 4) * 6;\n\n if (tailbits === 0) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n } else if (tailbits === 18) {\n result.push((bits >> 10) & 0xFF);\n result.push((bits >> 2) & 0xFF);\n } else if (tailbits === 12) {\n result.push((bits >> 4) & 0xFF);\n }\n\n // Wrap into Buffer for NodeJS and leave Array for browser\n if (NodeBuffer) {\n return new NodeBuffer(result);\n }\n\n return result;\n}\n\nfunction representYamlBinary(object /*, style*/) {\n var result = '', bits = 0, idx, tail,\n max = object.length,\n map = BASE64_MAP;\n\n // Convert every three bytes to 4 ASCII characters.\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 3 === 0) && idx) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n }\n\n bits = (bits << 8) + object[idx];\n }\n\n // Dump tail\n\n tail = max % 3;\n\n if (tail === 0) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n } else if (tail === 2) {\n result += map[(bits >> 10) & 0x3F];\n result += map[(bits >> 4) & 0x3F];\n result += map[(bits << 2) & 0x3F];\n result += map[64];\n } else if (tail === 1) {\n result += map[(bits >> 2) & 0x3F];\n result += map[(bits << 4) & 0x3F];\n result += map[64];\n result += map[64];\n }\n\n return result;\n}\n\nfunction isBinary(object) {\n return NodeBuffer && NodeBuffer.isBuffer(object);\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:binary', {\n kind: 'scalar',\n resolve: resolveYamlBinary,\n construct: constructYamlBinary,\n predicate: isBinary,\n represent: representYamlBinary\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nfunction resolveYamlBoolean(data) {\n if (null === data) {\n return false;\n }\n\n var max = data.length;\n\n return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||\n (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));\n}\n\nfunction constructYamlBoolean(data) {\n return data === 'true' ||\n data === 'True' ||\n data === 'TRUE';\n}\n\nfunction isBoolean(object) {\n return '[object Boolean]' === Object.prototype.toString.call(object);\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:bool', {\n kind: 'scalar',\n resolve: resolveYamlBoolean,\n construct: constructYamlBoolean,\n predicate: isBoolean,\n represent: {\n lowercase: function (object) { return object ? 'true' : 'false'; },\n uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },\n camelcase: function (object) { return object ? 'True' : 'False'; }\n },\n defaultStyle: 'lowercase'\n});\n", + "'use strict';\n\nvar common = require('../common');\nvar Type = require('../type');\n\nvar YAML_FLOAT_PATTERN = new RegExp(\n '^(?:[-+]?(?:[0-9][0-9_]*)\\\\.[0-9_]*(?:[eE][-+][0-9]+)?' +\n '|\\\\.[0-9_]+(?:[eE][-+][0-9]+)?' +\n '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*' +\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n '|\\\\.(?:nan|NaN|NAN))$');\n\nfunction resolveYamlFloat(data) {\n if (null === data) {\n return false;\n }\n\n if (!YAML_FLOAT_PATTERN.test(data)) {\n return false;\n }\n return true;\n}\n\nfunction constructYamlFloat(data) {\n var value, sign, base, digits;\n\n value = data.replace(/_/g, '').toLowerCase();\n sign = '-' === value[0] ? -1 : 1;\n digits = [];\n\n if (0 <= '+-'.indexOf(value[0])) {\n value = value.slice(1);\n }\n\n if ('.inf' === value) {\n return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;\n\n } else if ('.nan' === value) {\n return NaN;\n\n } else if (0 <= value.indexOf(':')) {\n value.split(':').forEach(function (v) {\n digits.unshift(parseFloat(v, 10));\n });\n\n value = 0.0;\n base = 1;\n\n digits.forEach(function (d) {\n value += d * base;\n base *= 60;\n });\n\n return sign * value;\n\n }\n return sign * parseFloat(value, 10);\n}\n\n\nvar SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;\n\nfunction representYamlFloat(object, style) {\n var res;\n\n if (isNaN(object)) {\n switch (style) {\n case 'lowercase':\n return '.nan';\n case 'uppercase':\n return '.NAN';\n case 'camelcase':\n return '.NaN';\n }\n } else if (Number.POSITIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase':\n return '.inf';\n case 'uppercase':\n return '.INF';\n case 'camelcase':\n return '.Inf';\n }\n } else if (Number.NEGATIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase':\n return '-.inf';\n case 'uppercase':\n return '-.INF';\n case 'camelcase':\n return '-.Inf';\n }\n } else if (common.isNegativeZero(object)) {\n return '-0.0';\n }\n\n res = object.toString(10);\n\n // JS stringifier can build scientific format without dots: 5e-100,\n // while YAML requres dot: 5.e-100. Fix it with simple hack\n\n return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;\n}\n\nfunction isFloat(object) {\n return ('[object Number]' === Object.prototype.toString.call(object)) &&\n (0 !== object % 1 || common.isNegativeZero(object));\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:float', {\n kind: 'scalar',\n resolve: resolveYamlFloat,\n construct: constructYamlFloat,\n predicate: isFloat,\n represent: representYamlFloat,\n defaultStyle: 'lowercase'\n});\n", + "'use strict';\n\nvar common = require('../common');\nvar Type = require('../type');\n\nfunction isHexCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||\n ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||\n ((0x61/* a */ <= c) && (c <= 0x66/* f */));\n}\n\nfunction isOctCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));\n}\n\nfunction isDecCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));\n}\n\nfunction resolveYamlInteger(data) {\n if (null === data) {\n return false;\n }\n\n var max = data.length,\n index = 0,\n hasDigits = false,\n ch;\n\n if (!max) { return false; }\n\n ch = data[index];\n\n // sign\n if (ch === '-' || ch === '+') {\n ch = data[++index];\n }\n\n if (ch === '0') {\n // 0\n if (index + 1 === max) { return true; }\n ch = data[++index];\n\n // base 2, base 8, base 16\n\n if (ch === 'b') {\n // base 2\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') { continue; }\n if (ch !== '0' && ch !== '1') {\n return false;\n }\n hasDigits = true;\n }\n return hasDigits;\n }\n\n\n if (ch === 'x') {\n // base 16\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') { continue; }\n if (!isHexCode(data.charCodeAt(index))) {\n return false;\n }\n hasDigits = true;\n }\n return hasDigits;\n }\n\n // base 8\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') { continue; }\n if (!isOctCode(data.charCodeAt(index))) {\n return false;\n }\n hasDigits = true;\n }\n return hasDigits;\n }\n\n // base 10 (except 0) or base 60\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') { continue; }\n if (ch === ':') { break; }\n if (!isDecCode(data.charCodeAt(index))) {\n return false;\n }\n hasDigits = true;\n }\n\n if (!hasDigits) { return false; }\n\n // if !base60 - done;\n if (ch !== ':') { return true; }\n\n // base60 almost not used, no needs to optimize\n return /^(:[0-5]?[0-9])+$/.test(data.slice(index));\n}\n\nfunction constructYamlInteger(data) {\n var value = data, sign = 1, ch, base, digits = [];\n\n if (value.indexOf('_') !== -1) {\n value = value.replace(/_/g, '');\n }\n\n ch = value[0];\n\n if (ch === '-' || ch === '+') {\n if (ch === '-') { sign = -1; }\n value = value.slice(1);\n ch = value[0];\n }\n\n if ('0' === value) {\n return 0;\n }\n\n if (ch === '0') {\n if (value[1] === 'b') {\n return sign * parseInt(value.slice(2), 2);\n }\n if (value[1] === 'x') {\n return sign * parseInt(value, 16);\n }\n return sign * parseInt(value, 8);\n\n }\n\n if (value.indexOf(':') !== -1) {\n value.split(':').forEach(function (v) {\n digits.unshift(parseInt(v, 10));\n });\n\n value = 0;\n base = 1;\n\n digits.forEach(function (d) {\n value += (d * base);\n base *= 60;\n });\n\n return sign * value;\n\n }\n\n return sign * parseInt(value, 10);\n}\n\nfunction isInteger(object) {\n return ('[object Number]' === Object.prototype.toString.call(object)) &&\n (0 === object % 1 && !common.isNegativeZero(object));\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:int', {\n kind: 'scalar',\n resolve: resolveYamlInteger,\n construct: constructYamlInteger,\n predicate: isInteger,\n represent: {\n binary: function (object) { return '0b' + object.toString(2); },\n octal: function (object) { return '0' + object.toString(8); },\n decimal: function (object) { return object.toString(10); },\n hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }\n },\n defaultStyle: 'decimal',\n styleAliases: {\n binary: [ 2, 'bin' ],\n octal: [ 8, 'oct' ],\n decimal: [ 10, 'dec' ],\n hexadecimal: [ 16, 'hex' ]\n }\n});\n", + "'use strict';\n\nvar esprima;\n\n// Browserified version does not have esprima\n//\n// 1. For node.js just require module as deps\n// 2. For browser try to require mudule via external AMD system.\n// If not found - try to fallback to window.esprima. If not\n// found too - then fail to parse.\n//\ntry {\n esprima = require('esprima');\n} catch (_) {\n /*global window */\n if (typeof window !== 'undefined') { esprima = window.esprima; }\n}\n\nvar Type = require('../../type');\n\nfunction resolveJavascriptFunction(data) {\n if (null === data) {\n return false;\n }\n\n try {\n var source = '(' + data + ')',\n ast = esprima.parse(source, { range: true });\n\n if ('Program' !== ast.type ||\n 1 !== ast.body.length ||\n 'ExpressionStatement' !== ast.body[0].type ||\n 'FunctionExpression' !== ast.body[0].expression.type) {\n return false;\n }\n\n return true;\n } catch (err) {\n return false;\n }\n}\n\nfunction constructJavascriptFunction(data) {\n /*jslint evil:true*/\n\n var source = '(' + data + ')',\n ast = esprima.parse(source, { range: true }),\n params = [],\n body;\n\n if ('Program' !== ast.type ||\n 1 !== ast.body.length ||\n 'ExpressionStatement' !== ast.body[0].type ||\n 'FunctionExpression' !== ast.body[0].expression.type) {\n throw new Error('Failed to resolve function');\n }\n\n ast.body[0].expression.params.forEach(function (param) {\n params.push(param.name);\n });\n\n body = ast.body[0].expression.body.range;\n\n // Esprima's ranges include the first '{' and the last '}' characters on\n // function expressions. So cut them out.\n /*eslint-disable no-new-func*/\n return new Function(params, source.slice(body[0] + 1, body[1] - 1));\n}\n\nfunction representJavascriptFunction(object /*, style*/) {\n return object.toString();\n}\n\nfunction isFunction(object) {\n return '[object Function]' === Object.prototype.toString.call(object);\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:js/function', {\n kind: 'scalar',\n resolve: resolveJavascriptFunction,\n construct: constructJavascriptFunction,\n predicate: isFunction,\n represent: representJavascriptFunction\n});\n", + "'use strict';\n\nvar Type = require('../../type');\n\nfunction resolveJavascriptRegExp(data) {\n if (null === data) {\n return false;\n }\n\n if (0 === data.length) {\n return false;\n }\n\n var regexp = data,\n tail = /\\/([gim]*)$/.exec(data),\n modifiers = '';\n\n // if regexp starts with '/' it can have modifiers and must be properly closed\n // `/foo/gim` - modifiers tail can be maximum 3 chars\n if ('/' === regexp[0]) {\n if (tail) {\n modifiers = tail[1];\n }\n\n if (modifiers.length > 3) { return false; }\n // if expression starts with /, is should be properly terminated\n if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }\n\n regexp = regexp.slice(1, regexp.length - modifiers.length - 1);\n }\n\n try {\n return true;\n } catch (error) {\n return false;\n }\n}\n\nfunction constructJavascriptRegExp(data) {\n var regexp = data,\n tail = /\\/([gim]*)$/.exec(data),\n modifiers = '';\n\n // `/foo/gim` - tail can be maximum 4 chars\n if ('/' === regexp[0]) {\n if (tail) {\n modifiers = tail[1];\n }\n regexp = regexp.slice(1, regexp.length - modifiers.length - 1);\n }\n\n return new RegExp(regexp, modifiers);\n}\n\nfunction representJavascriptRegExp(object /*, style*/) {\n var result = '/' + object.source + '/';\n\n if (object.global) {\n result += 'g';\n }\n\n if (object.multiline) {\n result += 'm';\n }\n\n if (object.ignoreCase) {\n result += 'i';\n }\n\n return result;\n}\n\nfunction isRegExp(object) {\n return '[object RegExp]' === Object.prototype.toString.call(object);\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:js/regexp', {\n kind: 'scalar',\n resolve: resolveJavascriptRegExp,\n construct: constructJavascriptRegExp,\n predicate: isRegExp,\n represent: representJavascriptRegExp\n});\n", + "'use strict';\n\nvar Type = require('../../type');\n\nfunction resolveJavascriptUndefined() {\n return true;\n}\n\nfunction constructJavascriptUndefined() {\n /*eslint-disable no-undefined*/\n return undefined;\n}\n\nfunction representJavascriptUndefined() {\n return '';\n}\n\nfunction isUndefined(object) {\n return 'undefined' === typeof object;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:js/undefined', {\n kind: 'scalar',\n resolve: resolveJavascriptUndefined,\n construct: constructJavascriptUndefined,\n predicate: isUndefined,\n represent: representJavascriptUndefined\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nmodule.exports = new Type('tag:yaml.org,2002:map', {\n kind: 'mapping',\n construct: function (data) { return null !== data ? data : {}; }\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nfunction resolveYamlMerge(data) {\n return '<<' === data || null === data;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:merge', {\n kind: 'scalar',\n resolve: resolveYamlMerge\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nfunction resolveYamlNull(data) {\n if (null === data) {\n return true;\n }\n\n var max = data.length;\n\n return (max === 1 && data === '~') ||\n (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));\n}\n\nfunction constructYamlNull() {\n return null;\n}\n\nfunction isNull(object) {\n return null === object;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:null', {\n kind: 'scalar',\n resolve: resolveYamlNull,\n construct: constructYamlNull,\n predicate: isNull,\n represent: {\n canonical: function () { return '~'; },\n lowercase: function () { return 'null'; },\n uppercase: function () { return 'NULL'; },\n camelcase: function () { return 'Null'; }\n },\n defaultStyle: 'lowercase'\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\nvar _toString = Object.prototype.toString;\n\nfunction resolveYamlOmap(data) {\n if (null === data) {\n return true;\n }\n\n var objectKeys = [], index, length, pair, pairKey, pairHasKey,\n object = data;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n pairHasKey = false;\n\n if ('[object Object]' !== _toString.call(pair)) {\n return false;\n }\n\n for (pairKey in pair) {\n if (_hasOwnProperty.call(pair, pairKey)) {\n if (!pairHasKey) {\n pairHasKey = true;\n } else {\n return false;\n }\n }\n }\n\n if (!pairHasKey) {\n return false;\n }\n\n if (-1 === objectKeys.indexOf(pairKey)) {\n objectKeys.push(pairKey);\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nfunction constructYamlOmap(data) {\n return null !== data ? data : [];\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:omap', {\n kind: 'sequence',\n resolve: resolveYamlOmap,\n construct: constructYamlOmap\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nvar _toString = Object.prototype.toString;\n\nfunction resolveYamlPairs(data) {\n if (null === data) {\n return true;\n }\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n if ('[object Object]' !== _toString.call(pair)) {\n return false;\n }\n\n keys = Object.keys(pair);\n\n if (1 !== keys.length) {\n return false;\n }\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return true;\n}\n\nfunction constructYamlPairs(data) {\n if (null === data) {\n return [];\n }\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n keys = Object.keys(pair);\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return result;\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:pairs', {\n kind: 'sequence',\n resolve: resolveYamlPairs,\n construct: constructYamlPairs\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nmodule.exports = new Type('tag:yaml.org,2002:seq', {\n kind: 'sequence',\n construct: function (data) { return null !== data ? data : []; }\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction resolveYamlSet(data) {\n if (null === data) {\n return true;\n }\n\n var key, object = data;\n\n for (key in object) {\n if (_hasOwnProperty.call(object, key)) {\n if (null !== object[key]) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction constructYamlSet(data) {\n return null !== data ? data : {};\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:set', {\n kind: 'mapping',\n resolve: resolveYamlSet,\n construct: constructYamlSet\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nmodule.exports = new Type('tag:yaml.org,2002:str', {\n kind: 'scalar',\n construct: function (data) { return null !== data ? data : ''; }\n});\n", + "'use strict';\n\nvar Type = require('../type');\n\nvar YAML_TIMESTAMP_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9]?)' + // [2] month\n '-([0-9][0-9]?)' + // [3] day\n '(?:(?:[Tt]|[ \\\\t]+)' + // ...\n '([0-9][0-9]?)' + // [4] hour\n ':([0-9][0-9])' + // [5] minute\n ':([0-9][0-9])' + // [6] second\n '(?:\\\\.([0-9]*))?' + // [7] fraction\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour\n '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute\n\nfunction resolveYamlTimestamp(data) {\n if (null === data) {\n return false;\n }\n\n if (YAML_TIMESTAMP_REGEXP.exec(data) === null) {\n return false;\n }\n\n return true;\n}\n\nfunction constructYamlTimestamp(data) {\n var match, year, month, day, hour, minute, second, fraction = 0,\n delta = null, tz_hour, tz_minute, date;\n\n match = YAML_TIMESTAMP_REGEXP.exec(data);\n\n if (null === match) {\n throw new Error('Date resolve error');\n }\n\n // match: [1] year [2] month [3] day\n\n year = +(match[1]);\n month = +(match[2]) - 1; // JS month starts with 0\n day = +(match[3]);\n\n if (!match[4]) { // no hour\n return new Date(Date.UTC(year, month, day));\n }\n\n // match: [4] hour [5] minute [6] second [7] fraction\n\n hour = +(match[4]);\n minute = +(match[5]);\n second = +(match[6]);\n\n if (match[7]) {\n fraction = match[7].slice(0, 3);\n while (fraction.length < 3) { // milli-seconds\n fraction += '0';\n }\n fraction = +fraction;\n }\n\n // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute\n\n if (match[9]) {\n tz_hour = +(match[10]);\n tz_minute = +(match[11] || 0);\n delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds\n if ('-' === match[9]) {\n delta = -delta;\n }\n }\n\n date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));\n\n if (delta) {\n date.setTime(date.getTime() - delta);\n }\n\n return date;\n}\n\nfunction representYamlTimestamp(object /*, style*/) {\n return object.toISOString();\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:timestamp', {\n kind: 'scalar',\n resolve: resolveYamlTimestamp,\n construct: constructYamlTimestamp,\n instanceOf: Date,\n represent: representYamlTimestamp\n});\n", + "/** !\n * JSON Schema $Ref Parser v1.4.1\n *\n * @link https://github.com/BigstickCarpet/json-schema-ref-parser\n * @license MIT\n */\n'use strict';\n\nvar $Ref = require('./ref'),\n Pointer = require('./pointer'),\n util = require('./util'),\n url = require('url');\n\nmodule.exports = bundle;\n\n/**\n * Bundles all external JSON references into the main JSON schema, thus resulting in a schema that\n * only has *internal* references, not any *external* references.\n * This method mutates the JSON schema object, adding new references and re-mapping existing ones.\n *\n * @param {$RefParser} parser\n * @param {$RefParserOptions} options\n */\nfunction bundle(parser, options) {\n util.debug('Bundling $ref pointers in %s', parser._basePath);\n\n remap(parser.$refs, options);\n dereference(parser._basePath, parser.$refs, options);\n}\n\n/**\n * Re-maps all $ref pointers in the schema, so that they are relative to the root of the schema.\n *\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n */\nfunction remap($refs, options) {\n var remapped = [];\n\n // Crawl the schema and determine the re-mapped values for all $ref pointers.\n // NOTE: We don't actually APPLY the re-mappings them yet, since that can affect other re-mappings\n Object.keys($refs._$refs).forEach(function(key) {\n var $ref = $refs._$refs[key];\n crawl($ref.value, $ref.path + '#', $refs, remapped, options);\n });\n\n // Now APPLY all of the re-mappings\n for (var i = 0; i < remapped.length; i++) {\n var mapping = remapped[i];\n mapping.old$Ref.$ref = mapping.new$Ref.$ref;\n }\n}\n\n/**\n * Recursively crawls the given value, and re-maps any JSON references.\n *\n * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored.\n * @param {string} path - The path to use for resolving relative JSON references\n * @param {$Refs} $refs - The resolved JSON references\n * @param {object[]} remapped - An array of the re-mapped JSON references\n * @param {$RefParserOptions} options\n */\nfunction crawl(obj, path, $refs, remapped, options) {\n if (obj && typeof obj === 'object') {\n Object.keys(obj).forEach(function(key) {\n var keyPath = Pointer.join(path, key);\n var value = obj[key];\n\n if ($Ref.is$Ref(value)) {\n // We found a $ref, so resolve it\n util.debug('Re-mapping $ref pointer \"%s\" at %s', value.$ref, keyPath);\n var $refPath = url.resolve(path, value.$ref);\n var pointer = $refs._resolve($refPath, options);\n\n // Re-map the value\n var new$RefPath = pointer.$ref.pathFromRoot + util.path.getHash(pointer.path).substr(1);\n util.debug(' new value: %s', new$RefPath);\n remapped.push({\n old$Ref: value,\n new$Ref: {$ref: new$RefPath} // Note: DON'T name this property `new` (https://github.com/BigstickCarpet/json-schema-ref-parser/issues/3)\n });\n }\n else {\n crawl(value, keyPath, $refs, remapped, options);\n }\n });\n }\n}\n\n/**\n * Dereferences each external $ref pointer exactly ONCE.\n *\n * @param {string} basePath\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n */\nfunction dereference(basePath, $refs, options) {\n basePath = util.path.stripHash(basePath);\n\n Object.keys($refs._$refs).forEach(function(key) {\n var $ref = $refs._$refs[key];\n if ($ref.pathFromRoot !== '#') {\n $refs.set(basePath + $ref.pathFromRoot, $ref.value, options);\n }\n });\n}\n", + "'use strict';\n\nvar $Ref = require('./ref'),\n Pointer = require('./pointer'),\n util = require('./util'),\n ono = require('ono'),\n url = require('url');\n\nmodule.exports = dereference;\n\n/**\n * Crawls the JSON schema, finds all JSON references, and dereferences them.\n * This method mutates the JSON schema object, replacing JSON references with their resolved value.\n *\n * @param {$RefParser} parser\n * @param {$RefParserOptions} options\n */\nfunction dereference(parser, options) {\n util.debug('Dereferencing $ref pointers in %s', parser._basePath);\n parser.$refs.circular = false;\n crawl(parser.schema, parser._basePath, [], parser.$refs, options);\n}\n\n/**\n * Recursively crawls the given value, and dereferences any JSON references.\n *\n * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored.\n * @param {string} path - The path to use for resolving relative JSON references\n * @param {object[]} parents - An array of the parent objects that have already been dereferenced\n * @param {$Refs} $refs - The resolved JSON references\n * @param {$RefParserOptions} options\n * @returns {boolean} - Returns true if a circular reference was found\n */\nfunction crawl(obj, path, parents, $refs, options) {\n var isCircular = false;\n\n if (obj && typeof obj === 'object') {\n parents.push(obj);\n\n Object.keys(obj).forEach(function(key) {\n var keyPath = Pointer.join(path, key);\n var value = obj[key];\n var circular = false;\n\n if ($Ref.isAllowed$Ref(value, options)) {\n // We found a $ref, so resolve it\n util.debug('Dereferencing $ref pointer \"%s\" at %s', value.$ref, keyPath);\n var $refPath = url.resolve(path, value.$ref);\n var pointer = $refs._resolve($refPath, options);\n\n // Check for circular references\n circular = pointer.circular || parents.indexOf(pointer.value) !== -1;\n circular && foundCircularReference(keyPath, $refs, options);\n\n // Dereference the JSON reference\n var dereferencedValue = getDereferencedValue(value, pointer.value);\n\n // Crawl the dereferenced value (unless it's circular)\n if (!circular) {\n // If the `crawl` method returns true, then dereferenced value is circular\n circular = crawl(dereferencedValue, pointer.path, parents, $refs, options);\n }\n\n // Replace the JSON reference with the dereferenced value\n if (!circular || options.$refs.circular === true) {\n obj[key] = dereferencedValue;\n }\n }\n else {\n if (parents.indexOf(value) === -1) {\n circular = crawl(value, keyPath, parents, $refs, options);\n }\n else {\n circular = foundCircularReference(keyPath, $refs, options);\n }\n }\n\n // Set the \"isCircular\" flag if this or any other property is circular\n isCircular = isCircular || circular;\n });\n\n parents.pop();\n }\n return isCircular;\n}\n\n/**\n * Returns the dereferenced value of the given JSON reference.\n *\n * @param {object} currentValue - the current value, which contains a JSON reference (\"$ref\" property)\n * @param {*} resolvedValue - the resolved value, which can be any type\n * @returns {*} - Returns the dereferenced value\n */\nfunction getDereferencedValue(currentValue, resolvedValue) {\n if (resolvedValue && typeof resolvedValue === 'object' && Object.keys(currentValue).length > 1) {\n // The current value has additional properties (other than \"$ref\"),\n // so merge the resolved value rather than completely replacing the reference\n var merged = {};\n Object.keys(currentValue).forEach(function(key) {\n if (key !== '$ref') {\n merged[key] = currentValue[key];\n }\n });\n Object.keys(resolvedValue).forEach(function(key) {\n if (!(key in merged)) {\n merged[key] = resolvedValue[key];\n }\n });\n return merged;\n }\n else {\n // Completely replace the original reference with the resolved value\n return resolvedValue;\n }\n}\n\n/**\n * Called when a circular reference is found.\n * It sets the {@link $Refs#circular} flag, and throws an error if options.$refs.circular is false.\n *\n * @param {string} keyPath - The JSON Reference path of the circular reference\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n * @returns {boolean} - always returns true, to indicate that a circular reference was found\n */\nfunction foundCircularReference(keyPath, $refs, options) {\n $refs.circular = true;\n if (!options.$refs.circular) {\n throw ono.reference('Circular $ref pointer found at %s', keyPath);\n }\n return true;\n}\n", + "'use strict';\n\nvar Promise = require('./promise'),\n Options = require('./options'),\n $Refs = require('./refs'),\n $Ref = require('./ref'),\n read = require('./read'),\n resolve = require('./resolve'),\n bundle = require('./bundle'),\n dereference = require('./dereference'),\n util = require('./util'),\n url = require('url'),\n maybe = require('call-me-maybe'),\n ono = require('ono');\n\nmodule.exports = $RefParser;\nmodule.exports.YAML = require('./yaml');\n\n/**\n * This class parses a JSON schema, builds a map of its JSON references and their resolved values,\n * and provides methods for traversing, manipulating, and dereferencing those references.\n *\n * @constructor\n */\nfunction $RefParser() {\n /**\n * The parsed (and possibly dereferenced) JSON schema object\n *\n * @type {object}\n * @readonly\n */\n this.schema = null;\n\n /**\n * The resolved JSON references\n *\n * @type {$Refs}\n */\n this.$refs = new $Refs();\n\n /**\n * The file path or URL of the main JSON schema file.\n * This will be empty if the schema was passed as an object rather than a path.\n *\n * @type {string}\n * @protected\n */\n this._basePath = '';\n}\n\n/**\n * Parses the given JSON schema.\n * This method does not resolve any JSON references.\n * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed\n * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.\n * @returns {Promise} - The returned promise resolves with the parsed JSON schema object.\n */\n$RefParser.parse = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().parse(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema.\n * This method does not resolve any JSON references.\n * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed\n * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object.\n * @returns {Promise} - The returned promise resolves with the parsed JSON schema object.\n */\n$RefParser.prototype.parse = function(schema, options, callback) {\n var args = normalizeArgs(arguments);\n\n if (args.schema && typeof args.schema === 'object') {\n // The schema is an object, not a path/url\n this.schema = args.schema;\n this._basePath = '';\n var $ref = new $Ref(this.$refs, this._basePath);\n $ref.setValue(this.schema, args.options);\n\n return maybe(args.callback, Promise.resolve(this.schema));\n }\n\n if (!args.schema || typeof args.schema !== 'string') {\n var err = ono('Expected a file path, URL, or object. Got %s', args.schema);\n return maybe(args.callback, Promise.reject(err));\n }\n\n var me = this;\n\n // Resolve the absolute path of the schema\n args.schema = util.path.localPathToUrl(args.schema);\n args.schema = url.resolve(util.path.cwd(), args.schema);\n this._basePath = util.path.stripHash(args.schema);\n\n // Read the schema file/url\n return read(args.schema, this.$refs, args.options)\n .then(function(cached$Ref) {\n var value = cached$Ref.$ref.value;\n if (!value || typeof value !== 'object' || value instanceof Buffer) {\n throw ono.syntax('\"%s\" is not a valid JSON Schema', me._basePath);\n }\n else {\n me.schema = value;\n return maybe(args.callback, Promise.resolve(me.schema));\n }\n })\n .catch(function(e) {\n return maybe(args.callback, Promise.reject(e));\n });\n};\n\n/**\n * Parses the given JSON schema and resolves any JSON references, including references in\n * externally-referenced files.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved\n * @param {function} [callback]\n * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references\n *\n * @returns {Promise}\n * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references\n */\n$RefParser.resolve = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().resolve(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema and resolves any JSON references, including references in\n * externally-referenced files.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved\n * @param {function} [callback]\n * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references\n *\n * @returns {Promise}\n * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references\n */\n$RefParser.prototype.resolve = function(schema, options, callback) {\n var me = this;\n var args = normalizeArgs(arguments);\n\n return this.parse(args.schema, args.options)\n .then(function() {\n return resolve(me, args.options);\n })\n .then(function() {\n return maybe(args.callback, Promise.resolve(me.$refs));\n })\n .catch(function(err) {\n return maybe(args.callback, Promise.reject(err));\n });\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and bundles all external references\n * into the main JSON schema. This produces a JSON schema that only has *internal* references,\n * not any *external* references.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object\n * @returns {Promise} - The returned promise resolves with the bundled JSON schema object.\n */\n$RefParser.bundle = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().bundle(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and bundles all external references\n * into the main JSON schema. This produces a JSON schema that only has *internal* references,\n * not any *external* references.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object\n * @returns {Promise} - The returned promise resolves with the bundled JSON schema object.\n */\n$RefParser.prototype.bundle = function(schema, options, callback) {\n var me = this;\n var args = normalizeArgs(arguments);\n\n return this.resolve(args.schema, args.options)\n .then(function() {\n bundle(me, args.options);\n return maybe(args.callback, Promise.resolve(me.schema));\n })\n .catch(function(err) {\n return maybe(args.callback, Promise.reject(err));\n });\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema.\n * That is, all JSON references are replaced with their resolved values.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object\n * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.\n */\n$RefParser.dereference = function(schema, options, callback) {\n var Class = this; // eslint-disable-line consistent-this\n return new Class().dereference(schema, options, callback);\n};\n\n/**\n * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema.\n * That is, all JSON references are replaced with their resolved values.\n *\n * @param {string|object} schema - The file path or URL of the JSON schema. Or a JSON schema object.\n * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced\n * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object\n * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object.\n */\n$RefParser.prototype.dereference = function(schema, options, callback) {\n var me = this;\n var args = normalizeArgs(arguments);\n\n return this.resolve(args.schema, args.options)\n .then(function() {\n dereference(me, args.options);\n return maybe(args.callback, Promise.resolve(me.schema));\n })\n .catch(function(err) {\n return maybe(args.callback, Promise.reject(err));\n });\n};\n\n/**\n * Normalizes the given arguments, accounting for optional args.\n *\n * @param {Arguments} args\n * @returns {object}\n */\nfunction normalizeArgs(args) {\n var options = args[1], callback = args[2];\n if (typeof options === 'function') {\n callback = options;\n options = undefined;\n }\n if (!(options instanceof Options)) {\n options = new Options(options);\n }\n return {\n schema: args[0],\n options: options,\n callback: callback\n };\n}\n", + "/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */\n'use strict';\n\nmodule.exports = $RefParserOptions;\n\n/**\n * Options that determine how JSON schemas are parsed, dereferenced, and cached.\n *\n * @param {object|$RefParserOptions} [options] - Overridden options\n * @constructor\n */\nfunction $RefParserOptions(options) {\n /**\n * Determines what types of files can be parsed\n */\n this.allow = {\n /**\n * Are JSON files allowed?\n * If false, then all schemas must be in YAML format.\n * @type {boolean}\n */\n json: true,\n\n /**\n * Are YAML files allowed?\n * If false, then all schemas must be in JSON format.\n * @type {boolean}\n */\n yaml: true,\n\n /**\n * Are zero-byte files allowed?\n * If false, then an error will be thrown if a file is empty.\n * @type {boolean}\n */\n empty: true,\n\n /**\n * Can unknown file types be $referenced?\n * If true, then they will be parsed as Buffers (byte arrays).\n * If false, then an error will be thrown.\n * @type {boolean}\n */\n unknown: true\n };\n\n /**\n * Determines the types of JSON references that are allowed.\n */\n this.$refs = {\n /**\n * Allow JSON references to other parts of the same file?\n * @type {boolean}\n */\n internal: true,\n\n /**\n * Allow JSON references to external files/URLs?\n * @type {boolean}\n */\n external: true,\n\n /**\n * Allow circular (recursive) JSON references?\n * If false, then a {@link ReferenceError} will be thrown if a circular reference is found.\n * If \"ignore\", then circular references will not be dereferenced.\n * @type {boolean|string}\n */\n circular: true\n };\n\n /**\n * How long to cache files (in seconds).\n */\n this.cache = {\n /**\n * How long to cache local files, in seconds.\n * @type {number}\n */\n fs: 60, // 1 minute\n\n /**\n * How long to cache files downloaded via HTTP, in seconds.\n * @type {number}\n */\n http: 5 * 60, // 5 minutes\n\n /**\n * How long to cache files downloaded via HTTPS, in seconds.\n * @type {number}\n */\n https: 5 * 60 // 5 minutes\n };\n\n merge(options, this);\n}\n\n/**\n * Fast, two-level object merge.\n *\n * @param {?object} src - The object to merge into dest\n * @param {object} dest - The object to be modified\n */\nfunction merge(src, dest) {\n if (src) {\n var topKeys = Object.keys(src);\n for (var i = 0; i < topKeys.length; i++) {\n var topKey = topKeys[i];\n var srcChild = src[topKey];\n if (dest[topKey] === undefined) {\n dest[topKey] = srcChild;\n }\n else {\n var childKeys = Object.keys(srcChild);\n for (var j = 0; j < childKeys.length; j++) {\n var childKey = childKeys[j];\n var srcChildValue = srcChild[childKey];\n if (srcChildValue !== undefined) {\n dest[topKey][childKey] = srcChildValue;\n }\n }\n }\n }\n }\n}\n", + "'use strict';\n\nvar YAML = require('./yaml'),\n util = require('./util'),\n ono = require('ono');\n\nmodule.exports = parse;\n\n/**\n * Parses the given data as YAML, JSON, or a raw Buffer (byte array), depending on the options.\n *\n * @param {string|Buffer} data - The data to be parsed\n * @param {string} path - The file path or URL that `data` came from\n * @param {$RefParserOptions} options\n *\n * @returns {string|Buffer|object}\n * If `data` can be parsed as YAML or JSON, then the returned value is a JavaScript object.\n * Otherwise, the returned value is the raw string or Buffer that was passed in.\n */\nfunction parse(data, path, options) {\n var parsed;\n\n try {\n if (options.allow.yaml) {\n util.debug('Parsing YAML file: %s', path);\n parsed = YAML.parse(data.toString());\n util.debug(' Parsed successfully');\n }\n else if (options.allow.json) {\n util.debug('Parsing JSON file: %s', path);\n parsed = JSON.parse(data.toString());\n util.debug(' Parsed successfully');\n }\n else {\n parsed = data;\n }\n }\n catch (e) {\n var ext = util.path.extname(path);\n if (options.allow.unknown && ['.json', '.yaml', '.yml'].indexOf(ext) === -1) {\n // It's not a YAML or JSON file, and unknown formats are allowed,\n // so ignore the parsing error and just return the raw data\n util.debug(' Unknown file format. Not parsed.');\n parsed = data;\n }\n else {\n throw ono.syntax(e, 'Error parsing \"%s\"', path);\n }\n }\n\n if (isEmpty(parsed) && !options.allow.empty) {\n throw ono.syntax('Error parsing \"%s\". \\nParsed value is empty', path);\n }\n\n return parsed;\n}\n\n/**\n * Determines whether the parsed value is \"empty\".\n *\n * @param {*} value\n * @returns {boolean}\n */\nfunction isEmpty(value) {\n return !value ||\n (typeof value === 'object' && Object.keys(value).length === 0) ||\n (typeof value === 'string' && value.trim().length === 0) ||\n (value instanceof Buffer && value.length === 0);\n}\n", + "'use strict';\n\nmodule.exports = Pointer;\n\nvar $Ref = require('./ref'),\n util = require('./util'),\n url = require('url'),\n ono = require('ono'),\n slashes = /\\//g,\n tildes = /~/g,\n escapedSlash = /~1/g,\n escapedTilde = /~0/g;\n\n/**\n * This class represents a single JSON pointer and its resolved value.\n *\n * @param {$Ref} $ref\n * @param {string} path\n * @constructor\n */\nfunction Pointer($ref, path) {\n /**\n * The {@link $Ref} object that contains this {@link Pointer} object.\n * @type {$Ref}\n */\n this.$ref = $ref;\n\n /**\n * The file path or URL, containing the JSON pointer in the hash.\n * This path is relative to the path of the main JSON schema file.\n * @type {string}\n */\n this.path = path;\n\n /**\n * The value of the JSON pointer.\n * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).\n * @type {?*}\n */\n this.value = undefined;\n\n /**\n * Indicates whether the pointer is references itself.\n * @type {boolean}\n */\n this.circular = false;\n}\n\n/**\n * Resolves the value of a nested property within the given object.\n *\n * @param {*} obj - The object that will be crawled\n * @param {$RefParserOptions} [options]\n *\n * @returns {Pointer}\n * Returns a JSON pointer whose {@link Pointer#value} is the resolved value.\n * If resolving this value required resolving other JSON references, then\n * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path\n * of the resolved value.\n */\nPointer.prototype.resolve = function(obj, options) {\n var tokens = Pointer.parse(this.path);\n\n // Crawl the object, one token at a time\n this.value = obj;\n for (var i = 0; i < tokens.length; i++) {\n if (resolveIf$Ref(this, options)) {\n // The $ref path has changed, so append the remaining tokens to the path\n this.path = Pointer.join(this.path, tokens.slice(i));\n }\n\n var token = tokens[i];\n if (this.value[token] === undefined) {\n throw ono.syntax('Error resolving $ref pointer \"%s\". \\nToken \"%s\" does not exist.', this.path, token);\n }\n else {\n this.value = this.value[token];\n }\n }\n\n // Resolve the final value\n resolveIf$Ref(this, options);\n return this;\n};\n\n/**\n * Sets the value of a nested property within the given object.\n *\n * @param {*} obj - The object that will be crawled\n * @param {*} value - the value to assign\n * @param {$RefParserOptions} [options]\n *\n * @returns {*}\n * Returns the modified object, or an entirely new object if the entire object is overwritten.\n */\nPointer.prototype.set = function(obj, value, options) {\n var tokens = Pointer.parse(this.path);\n var token;\n\n if (tokens.length === 0) {\n // There are no tokens, replace the entire object with the new value\n this.value = value;\n return value;\n }\n\n // Crawl the object, one token at a time\n this.value = obj;\n for (var i = 0; i < tokens.length - 1; i++) {\n resolveIf$Ref(this, options);\n\n token = tokens[i];\n if (this.value && this.value[token] !== undefined) {\n // The token exists\n this.value = this.value[token];\n }\n else {\n // The token doesn't exist, so create it\n this.value = setValue(this, token, {});\n }\n }\n\n // Set the value of the final token\n resolveIf$Ref(this, options);\n token = tokens[tokens.length - 1];\n setValue(this, token, value);\n\n // Return the updated object\n return obj;\n};\n\n/**\n * Parses a JSON pointer (or a path containing a JSON pointer in the hash)\n * and returns an array of the pointer's tokens.\n * (e.g. \"schema.json#/definitions/person/name\" => [\"definitions\", \"person\", \"name\"])\n *\n * The pointer is parsed according to RFC 6901\n * {@link https://tools.ietf.org/html/rfc6901#section-3}\n *\n * @param {string} path\n * @returns {string[]}\n */\nPointer.parse = function(path) {\n // Get the JSON pointer from the path's hash\n var pointer = util.path.getHash(path).substr(1);\n\n // If there's no pointer, then there are no tokens,\n // so return an empty array\n if (!pointer) {\n return [];\n }\n\n // Split into an array\n pointer = pointer.split('/');\n\n // Decode each part, according to RFC 6901\n for (var i = 0; i < pointer.length; i++) {\n pointer[i] = decodeURI(pointer[i].replace(escapedSlash, '/').replace(escapedTilde, '~'));\n }\n\n if (pointer[0] !== '') {\n throw ono.syntax('Invalid $ref pointer \"%s\". Pointers must begin with \"#/\"', pointer);\n }\n\n return pointer.slice(1);\n};\n\n/**\n * Creates a JSON pointer path, by joining one or more tokens to a base path.\n *\n * @param {string} base - The base path (e.g. \"schema.json#/definitions/person\")\n * @param {string|string[]} tokens - The token(s) to append (e.g. [\"name\", \"first\"])\n * @returns {string}\n */\nPointer.join = function(base, tokens) {\n // Ensure that the base path contains a hash\n if (base.indexOf('#') === -1) {\n base += '#';\n }\n\n // Append each token to the base path\n tokens = Array.isArray(tokens) ? tokens : [tokens];\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n // Encode the token, according to RFC 6901\n base += '/' + encodeURI(token.replace(tildes, '~0').replace(slashes, '~1'));\n }\n\n return base;\n};\n\n/**\n * If the given pointer's {@link Pointer#value} is a JSON reference,\n * then the reference is resolved and {@link Pointer#value} is replaced with the resolved value.\n * In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the\n * resolution path of the new value.\n *\n * @param {Pointer} pointer\n * @param {$RefParserOptions} [options]\n * @returns {boolean} - Returns `true` if the resolution path changed\n */\nfunction resolveIf$Ref(pointer, options) {\n // Is the value a JSON reference? (and allowed?)\n if ($Ref.isAllowed$Ref(pointer.value, options)) {\n var $refPath = url.resolve(pointer.path, pointer.value.$ref);\n\n if ($refPath === pointer.path) {\n // The value is a reference to itself, so there's nothing to do.\n pointer.circular = true;\n }\n else {\n // Does the JSON reference have other properties (other than \"$ref\")?\n // If so, then don't resolve it, since it represents a new type\n if (Object.keys(pointer.value).length === 1) {\n // Resolve the reference\n var resolved = pointer.$ref.$refs._resolve($refPath);\n pointer.$ref = resolved.$ref;\n pointer.path = resolved.path;\n pointer.value = resolved.value;\n return true;\n }\n }\n }\n}\n\n/**\n * Sets the specified token value of the {@link Pointer#value}.\n *\n * The token is evaluated according to RFC 6901.\n * {@link https://tools.ietf.org/html/rfc6901#section-4}\n *\n * @param {Pointer} pointer - The JSON Pointer whose value will be modified\n * @param {string} token - A JSON Pointer token that indicates how to modify `obj`\n * @param {*} value - The value to assign\n * @returns {*} - Returns the assigned value\n */\nfunction setValue(pointer, token, value) {\n if (pointer.value && typeof pointer.value === 'object') {\n if (token === '-' && Array.isArray(pointer.value)) {\n pointer.value.push(value);\n }\n else {\n pointer.value[token] = value;\n }\n }\n else {\n throw ono.syntax('Error assigning $ref pointer \"%s\". \\nCannot set \"%s\" of a non-object.', pointer.path, token);\n }\n return value;\n}\n", + "'use strict';\n\nvar fs = require('fs'),\n http = require('http'),\n https = require('https'),\n parse = require('./parse'),\n util = require('./util'),\n $Ref = require('./ref'),\n Promise = require('./promise'),\n url = require('url'),\n ono = require('ono');\n\nmodule.exports = read;\n\n/**\n * Reads the specified file path or URL, possibly from cache.\n *\n * @param {string} path - This path MUST already be resolved, since `read` doesn't know the resolution context\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves with an object that contains a {@link $Ref}\n * and a flag indicating whether the {@link $Ref} came from cache or not.\n */\nfunction read(path, $refs, options) {\n try {\n // Remove the URL fragment, if any\n path = util.path.stripHash(path);\n util.debug('Reading %s', path);\n\n // Return from cache, if possible\n var $ref = $refs._get$Ref(path);\n if ($ref && !$ref.isExpired()) {\n util.debug(' cached from %s', $ref.pathType);\n return Promise.resolve({\n $ref: $ref,\n cached: true\n });\n }\n\n // Add a placeholder $ref to the cache, so we don't read this URL multiple times\n $ref = new $Ref($refs, path);\n\n // Read and return the $ref\n return read$Ref($ref, options);\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Reads the specified file path or URL and updates the given {@link $Ref} accordingly.\n *\n * @param {$Ref} $ref - The {@link $Ref} to read and update\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves with the updated {@link $Ref} object (the same instance that was passed in)\n */\nfunction read$Ref($ref, options) {\n try {\n var promise = options.$refs.external && (read$RefFile($ref, options) || read$RefUrl($ref, options));\n\n if (promise) {\n return promise\n .then(function(data) {\n // Update the $ref with the parsed file contents\n var value = parse(data, $ref.path, options);\n $ref.setValue(value, options);\n\n return {\n $ref: $ref,\n cached: false\n };\n });\n }\n else {\n return Promise.reject(ono.syntax('Unable to resolve $ref pointer \"%s\"', $ref.path));\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * If the given {@link $Ref#path} is a local file, then the file is read\n * and {@link $Ref#type} is set to \"fs\".\n *\n * @param {$Ref} $ref - The {@link $Ref} to read and update\n * @param {$RefParserOptions} options\n *\n * @returns {Promise|undefined}\n * Returns a promise if {@link $Ref#path} is a local file.\n * The promise resolves with the raw file contents.\n */\nfunction read$RefFile($ref, options) {\n if (process.browser || util.path.isUrl($ref.path)) {\n return;\n }\n\n $ref.pathType = 'fs';\n return new Promise(function(resolve, reject) {\n var file;\n try {\n file = util.path.urlToLocalPath($ref.path);\n }\n catch (err) {\n reject(ono.uri(err, 'Malformed URI: %s', $ref.path));\n }\n\n util.debug('Opening file: %s', file);\n\n try {\n fs.readFile(file, function(err, data) {\n if (err) {\n reject(ono(err, 'Error opening file \"%s\"', $ref.path));\n }\n else {\n resolve(data);\n }\n });\n }\n catch (err) {\n reject(ono(err, 'Error opening file \"%s\"', file));\n }\n });\n}\n\n/**\n * If the given {@link $Ref#path} is a URL, then the file is downloaded\n * and {@link $Ref#type} is set to \"http\" or \"https\".\n *\n * @param {$Ref} $ref - The {@link $Ref} to read and update\n * @param {$RefParserOptions} options\n *\n * @returns {Promise|undefined}\n * Returns a promise if {@link $Ref#path} is a URL.\n * The promise resolves with the raw file contents.\n */\nfunction read$RefUrl($ref, options) {\n var u = url.parse($ref.path);\n\n if (process.browser && !u.protocol) {\n // Use the protocol of the current page\n u.protocol = url.parse(location.href).protocol;\n }\n\n if (u.protocol === 'http:') {\n $ref.pathType = 'http';\n return download(http, u, options);\n }\n else if (u.protocol === 'https:') {\n $ref.pathType = 'https';\n return download(https, u, options);\n }\n}\n\n/**\n * Downloads the specified file.\n *\n * @param {http|https} protocol - Download via HTTP or HTTPS\n * @param {Url} u - A parsed {@link Url} object\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves with the raw downloaded data, or rejects if there is an HTTP error.\n */\nfunction download(protocol, u, options) {\n return new Promise(function(resolve, reject) {\n try {\n util.debug('Downloading file: %s', u);\n\n var req = protocol.get(\n {\n hostname: u.hostname,\n port: u.port,\n path: u.path,\n auth: u.auth\n },\n onResponse\n );\n\n if (typeof req.setTimeout === 'function') {\n req.setTimeout(5000);\n }\n\n req.on('timeout', function() {\n req.abort();\n });\n\n req.on('error', function(err) {\n reject(ono(err, 'Error downloading file \"%s\"', u.href));\n });\n }\n catch (err) {\n reject(ono(err, 'Error downloading file \"%s\"', u.href));\n }\n\n /**\n * Handles the response\n *\n * @param {Response} res\n */\n function onResponse(res) {\n var body;\n\n res.on('data', function(data) {\n if (body) {\n body = Buffer.concat([new Buffer(body), new Buffer(data)]);\n }\n else {\n body = data;\n }\n });\n\n res.on('end', function() {\n if (res.statusCode >= 400) {\n reject(ono('GET %s \\nHTTP ERROR %d \\n%s', u.href, res.statusCode, body));\n }\n else if ((res.statusCode === 204 || !body || !body.length) && !options.allow.empty) {\n reject(ono('GET %s \\nHTTP 204: No Content', u.href));\n }\n else {\n resolve(body || '');\n }\n });\n\n res.on('error', function(err) {\n reject(ono(err, 'Error downloading file \"%s\"', u.href));\n });\n }\n });\n}\n", + "'use strict';\n\nmodule.exports = $Ref;\n\nvar Pointer = require('./pointer'),\n util = require('./util');\n\n/**\n * This class represents a single JSON reference and its resolved value.\n *\n * @param {$Refs} $refs\n * @param {string} path\n * @constructor\n */\nfunction $Ref($refs, path) {\n path = util.path.stripHash(path);\n\n // Add this $ref to its parent collection\n $refs._$refs[path] = this;\n\n /**\n * The {@link $Refs} object that contains this {@link $Ref} object.\n * @type {$Refs}\n */\n this.$refs = $refs;\n\n /**\n * The file path or URL of the referenced file.\n * This path is relative to the path of the main JSON schema file.\n *\n * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file.\n * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get\n * specific JSON pointers within the file.\n *\n * @type {string}\n */\n this.path = path;\n\n /**\n * Indicates the type of {@link $Ref#path} (e.g. \"fs\", \"http\", or \"https\")\n * @type {?string}\n */\n this.pathType = undefined;\n\n /**\n * The path TO this JSON reference from the root of the main JSON schema file.\n * If the same JSON reference occurs multiple times in the schema, then this is the pointer to the\n * FIRST occurrence.\n *\n * This property is used by the {@link $RefParser.bundle} method to re-map other JSON references.\n *\n * @type {string}\n */\n this.pathFromRoot = '#';\n\n /**\n * The resolved value of the JSON reference.\n * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).\n * @type {?*}\n */\n this.value = undefined;\n\n /**\n * The date/time that the cached value will expire.\n * @type {?Date}\n */\n this.expires = undefined;\n}\n\n/**\n * Determines whether the {@link $Ref#value} has expired.\n *\n * @returns {boolean}\n */\n$Ref.prototype.isExpired = function() {\n return !!(this.expires && this.expires <= new Date());\n};\n\n/**\n * Immediately expires the {@link $Ref#value}.\n */\n$Ref.prototype.expire = function() {\n this.expires = new Date();\n};\n\n/**\n * Sets the {@link $Ref#value} and renews the cache expiration.\n *\n * @param {*} value\n * @param {$RefParserOptions} options\n */\n$Ref.prototype.setValue = function(value, options) {\n this.value = value;\n\n // Extend the cache expiration\n var cacheDuration = options.cache[this.pathType];\n if (cacheDuration > 0) {\n var expires = Date.now() + (cacheDuration * 1000);\n this.expires = new Date(expires);\n }\n};\n\n/**\n * Determines whether the given JSON reference exists within this {@link $Ref#value}.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @returns {boolean}\n */\n$Ref.prototype.exists = function(path) {\n try {\n this.resolve(path);\n return true;\n }\n catch (e) {\n return false;\n }\n};\n\n/**\n * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {*} - Returns the resolved value\n */\n$Ref.prototype.get = function(path, options) {\n return this.resolve(path, options).value;\n};\n\n/**\n * Resolves the given JSON reference within this {@link $Ref#value}.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {Pointer}\n */\n$Ref.prototype.resolve = function(path, options) {\n var pointer = new Pointer(this, path);\n return pointer.resolve(this.value, options);\n};\n\n/**\n * Sets the value of a nested property within this {@link $Ref#value}.\n * If the property, or any of its parents don't exist, they will be created.\n *\n * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash\n * @param {*} value - The value to assign\n * @param {$RefParserOptions} options\n */\n$Ref.prototype.set = function(path, value, options) {\n var pointer = new Pointer(this, path);\n this.value = pointer.set(this.value, value, options);\n};\n\n/**\n * Determines whether the given value is a JSON reference.\n *\n * @param {*} value - The value to inspect\n * @returns {boolean}\n */\n$Ref.is$Ref = function(value) {\n return value && typeof value === 'object' && typeof value.$ref === 'string' && value.$ref.length > 0;\n};\n\n/**\n * Determines whether the given value is an external JSON reference.\n *\n * @param {*} value - The value to inspect\n * @returns {boolean}\n */\n$Ref.isExternal$Ref = function(value) {\n return $Ref.is$Ref(value) && value.$ref[0] !== '#';\n};\n\n/**\n * Determines whether the given value is a JSON reference, and whether it is allowed by the options.\n * For example, if it references an external file, then options.$refs.external must be true.\n *\n * @param {*} value - The value to inspect\n * @param {$RefParserOptions} options\n * @returns {boolean}\n */\n$Ref.isAllowed$Ref = function(value, options) {\n if ($Ref.is$Ref(value)) {\n if (value.$ref[0] === '#') {\n if (options.$refs.internal) {\n return true;\n }\n }\n else if (options.$refs.external) {\n return true;\n }\n }\n};\n", + "'use strict';\n\nvar Options = require('./options'),\n util = require('./util'),\n ono = require('ono');\n\nmodule.exports = $Refs;\n\n/**\n * This class is a map of JSON references and their resolved values.\n */\nfunction $Refs() {\n /**\n * Indicates whether the schema contains any circular references.\n *\n * @type {boolean}\n */\n this.circular = false;\n\n /**\n * A map of paths/urls to {@link $Ref} objects\n *\n * @type {object}\n * @protected\n */\n this._$refs = {};\n}\n\n/**\n * Returns the paths of all the files/URLs that are referenced by the JSON schema,\n * including the schema itself.\n *\n * @param {...string|string[]} [types] - Only return paths of the given types (\"fs\", \"http\", \"https\")\n * @returns {string[]}\n */\n$Refs.prototype.paths = function(types) {\n var paths = getPaths(this._$refs, arguments);\n return paths.map(function(path) {\n return path.decoded;\n });\n};\n\n/**\n * Returns the map of JSON references and their resolved values.\n *\n * @param {...string|string[]} [types] - Only return references of the given types (\"fs\", \"http\", \"https\")\n * @returns {object}\n */\n$Refs.prototype.values = function(types) {\n var $refs = this._$refs;\n var paths = getPaths($refs, arguments);\n return paths.reduce(function(obj, path) {\n obj[path.decoded] = $refs[path.encoded].value;\n return obj;\n }, {});\n};\n\n/**\n * Returns a POJO (plain old JavaScript object) for serialization as JSON.\n *\n * @returns {object}\n */\n$Refs.prototype.toJSON = $Refs.prototype.values;\n\n/**\n * Determines whether the given JSON reference has expired.\n * Returns true if the reference does not exist.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @returns {boolean}\n */\n$Refs.prototype.isExpired = function(path) {\n var $ref = this._get$Ref(path);\n return $ref === undefined || $ref.isExpired();\n};\n\n/**\n * Immediately expires the given JSON reference.\n * If the reference does not exist, nothing happens.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n */\n$Refs.prototype.expire = function(path) {\n var $ref = this._get$Ref(path);\n if ($ref) {\n $ref.expire();\n }\n};\n\n/**\n * Determines whether the given JSON reference exists.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @returns {boolean}\n */\n$Refs.prototype.exists = function(path) {\n try {\n this._resolve(path);\n return true;\n }\n catch (e) {\n return false;\n }\n};\n\n/**\n * Resolves the given JSON reference and returns the resolved value.\n *\n * @param {string} path - The full path being resolved, with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {*} - Returns the resolved value\n */\n$Refs.prototype.get = function(path, options) {\n return this._resolve(path, options).value;\n};\n\n/**\n * Sets the value of a nested property within this {@link $Ref#value}.\n * If the property, or any of its parents don't exist, they will be created.\n *\n * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash\n * @param {*} value - The value to assign\n * @param {$RefParserOptions} options\n */\n$Refs.prototype.set = function(path, value, options) {\n var withoutHash = util.path.stripHash(path);\n var $ref = this._$refs[withoutHash];\n\n if (!$ref) {\n throw ono('Error resolving $ref pointer \"%s\". \\n\"%s\" not found.', path, withoutHash);\n }\n\n options = new Options(options);\n $ref.set(path, value, options);\n};\n\n/**\n * Resolves the given JSON reference.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @param {$RefParserOptions} options\n * @returns {Pointer}\n * @protected\n */\n$Refs.prototype._resolve = function(path, options) {\n var withoutHash = util.path.stripHash(path);\n var $ref = this._$refs[withoutHash];\n\n if (!$ref) {\n throw ono('Error resolving $ref pointer \"%s\". \\n\"%s\" not found.', path, withoutHash);\n }\n\n options = new Options(options);\n return $ref.resolve(path, options);\n};\n\n/**\n * Returns the specified {@link $Ref} object, or undefined.\n *\n * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash\n * @returns {$Ref|undefined}\n * @protected\n */\n$Refs.prototype._get$Ref = function(path) {\n var withoutHash = util.path.stripHash(path);\n return this._$refs[withoutHash];\n};\n\n/**\n * Returns the encoded and decoded paths keys of the given object.\n *\n * @param {object} $refs - The object whose keys are URL-encoded paths\n * @param {...string|string[]} [types] - Only return paths of the given types (\"fs\", \"http\", \"https\")\n * @returns {object[]}\n */\nfunction getPaths($refs, types) {\n var paths = Object.keys($refs);\n\n // Filter the paths by type\n types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types);\n if (types.length > 0 && types[0]) {\n paths = paths.filter(function(key) {\n return types.indexOf($refs[key].pathType) !== -1;\n });\n }\n\n // Decode local filesystem paths\n return paths.map(function(path) {\n return {\n encoded: path,\n decoded: $refs[path].pathType === 'fs' ? util.path.urlToLocalPath(path) : path\n };\n });\n}\n", + "'use strict';\n\nvar Promise = require('./promise'),\n $Ref = require('./ref'),\n Pointer = require('./pointer'),\n read = require('./read'),\n util = require('./util'),\n url = require('url'),\n ono = require('ono');\n\nmodule.exports = resolve;\n\n/**\n * Crawls the JSON schema, finds all external JSON references, and resolves their values.\n * This method does not mutate the JSON schema. The resolved values are added to {@link $RefParser#$refs}.\n *\n * NOTE: We only care about EXTERNAL references here. INTERNAL references are only relevant when dereferencing.\n *\n * @param {$RefParser} parser\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves once all JSON references in the schema have been resolved,\n * including nested references that are contained in externally-referenced files.\n */\nfunction resolve(parser, options) {\n try {\n if (!options.$refs.external) {\n // Nothing to resolve, so exit early\n return Promise.resolve();\n }\n\n util.debug('Resolving $ref pointers in %s', parser._basePath);\n var promises = crawl(parser.schema, parser._basePath + '#', '#', parser.$refs, options);\n return Promise.all(promises);\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Recursively crawls the given value, and resolves any external JSON references.\n *\n * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored.\n * @param {string} path - The file path or URL used to resolve relative JSON references.\n * @param {string} pathFromRoot - The path to this point from the schema root\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n *\n * @returns {Promise[]}\n * Returns an array of promises. There will be one promise for each JSON reference in `obj`.\n * If `obj` does not contain any JSON references, then the array will be empty.\n * If any of the JSON references point to files that contain additional JSON references,\n * then the corresponding promise will internally reference an array of promises.\n */\nfunction crawl(obj, path, pathFromRoot, $refs, options) {\n var promises = [];\n\n if (obj && typeof obj === 'object') {\n var keys = Object.keys(obj);\n\n // If there's a \"definitions\" property, then crawl it FIRST.\n // This is important when bundling, since the expected behavior\n // is to bundle everything into definitions if possible.\n var defs = keys.indexOf('definitions');\n if (defs > 0) {\n keys.splice(0, 0, keys.splice(defs, 1)[0]);\n }\n\n keys.forEach(function(key) {\n var keyPath = Pointer.join(path, key);\n var keyPathFromRoot = Pointer.join(pathFromRoot, key);\n var value = obj[key];\n\n if ($Ref.isExternal$Ref(value)) {\n // We found a $ref\n util.debug('Resolving $ref pointer \"%s\" at %s', value.$ref, keyPath);\n var $refPath = url.resolve(path, value.$ref);\n\n // Crawl the $referenced value\n var promise = crawl$Ref($refPath, keyPathFromRoot, $refs, options)\n .catch(function(err) {\n throw ono.syntax(err, 'Error at %s', keyPath);\n });\n promises.push(promise);\n }\n else {\n promises = promises.concat(crawl(value, keyPath, keyPathFromRoot, $refs, options));\n }\n });\n }\n return promises;\n}\n\n/**\n * Reads the file/URL at the given path, and then crawls the resulting value and resolves\n * any external JSON references.\n *\n * @param {string} path - The file path or URL to crawl\n * @param {string} pathFromRoot - The path to this point from the schema root\n * @param {$Refs} $refs\n * @param {$RefParserOptions} options\n *\n * @returns {Promise}\n * The promise resolves once all JSON references in the object have been resolved,\n * including nested references that are contained in externally-referenced files.\n */\nfunction crawl$Ref(path, pathFromRoot, $refs, options) {\n return read(path, $refs, options)\n .then(function(cached$Ref) {\n // If a cached $ref is returned, then we DON'T need to crawl it\n if (!cached$Ref.cached) {\n var $ref = cached$Ref.$ref;\n\n // This is a new $ref, so store the path from the root of the JSON schema to this $ref\n $ref.pathFromRoot = pathFromRoot;\n\n // Crawl the new $ref\n util.debug('Resolving $ref pointers in %s', $ref.path);\n var promises = crawl($ref.value, $ref.path + '#', pathFromRoot, $refs, options);\n return Promise.all(promises);\n }\n });\n}\n", + "'use strict';\n\nvar debug = require('debug'),\n isWindows = /^win/.test(process.platform),\n forwardSlashPattern = /\\//g,\n protocolPattern = /^[a-z0-9.+-]+:\\/\\//i;\n\n// RegExp patterns to URL-encode special characters in local filesystem paths\nvar urlEncodePatterns = [\n /\\?/g, '%3F',\n /\\#/g, '%23',\n isWindows ? /\\\\/g : /\\//, '/'\n];\n\n// RegExp patterns to URL-decode special characters for local filesystem paths\nvar urlDecodePatterns = [\n /\\%23/g, '#',\n /\\%24/g, '$',\n /\\%26/g, '&',\n /\\%2C/g, ',',\n /\\%40/g, '@'\n];\n\n/**\n * Writes messages to stdout.\n * Log messages are suppressed by default, but can be enabled by setting the DEBUG variable.\n * @type {function}\n */\nexports.debug = debug('json-schema-ref-parser');\n\n/**\n * Utility functions for working with paths and URLs.\n */\nexports.path = {};\n\n/**\n * Returns the current working directory (in Node) or the current page URL (in browsers).\n *\n * @returns {string}\n */\nexports.path.cwd = function cwd() {\n return process.browser ? location.href : process.cwd() + '/';\n};\n\n/**\n * Determines whether the given path is a URL.\n *\n * @param {string} path\n * @returns {boolean}\n */\nexports.path.isUrl = function isUrl(path) {\n return protocolPattern.test(path);\n};\n\n/**\n * If the given path is a local filesystem path, it is converted to a URL.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.path.localPathToUrl = function localPathToUrl(path) {\n if (!process.browser && !exports.path.isUrl(path)) {\n // Manually encode characters that are not encoded by `encodeURI`\n for (var i = 0; i < urlEncodePatterns.length; i += 2) {\n path = path.replace(urlEncodePatterns[i], urlEncodePatterns[i + 1]);\n }\n path = encodeURI(path);\n }\n return path;\n};\n\n/**\n * Converts a URL to a local filesystem path\n *\n * @param {string} url\n * @returns {string}\n */\nexports.path.urlToLocalPath = function urlToLocalPath(url) {\n url = decodeURI(url);\n // Manually decode characters that are not decoded by `decodeURI`\n for (var i = 0; i < urlDecodePatterns.length; i += 2) {\n url = url.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);\n }\n if (isWindows) {\n url = url.replace(forwardSlashPattern, '\\\\');\n }\n return url;\n};\n\n/**\n * Returns the hash (URL fragment), if any, of the given path.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.path.getHash = function getHash(path) {\n var hashIndex = path.indexOf('#');\n if (hashIndex >= 0) {\n return path.substr(hashIndex);\n }\n return '';\n};\n\n/**\n * Removes the hash (URL fragment), if any, from the given path.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.path.stripHash = function stripHash(path) {\n var hashIndex = path.indexOf('#');\n if (hashIndex >= 0) {\n path = path.substr(0, hashIndex);\n }\n return path;\n};\n\n/**\n * Returns the file extension of the given path.\n *\n * @param {string} path\n * @returns {string}\n */\nexports.path.extname = function extname(path) {\n var lastDot = path.lastIndexOf('.');\n if (lastDot >= 0) {\n return path.substr(lastDot).toLowerCase();\n }\n return '';\n};\n", "/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */\n'use strict';\n\nvar yaml = require('js-yaml'),\n ono = require('ono');\n\n/**\n * Simple YAML parsing functions, similar to {@link JSON.parse} and {@link JSON.stringify}\n */\nmodule.exports = {\n /**\n * Parses a YAML string and returns the value.\n *\n * @param {string} text - The YAML string to be parsed\n * @param {function} [reviver] - Not currently supported. Provided for consistency with {@link JSON.parse}\n * @returns {*}\n */\n parse: function yamlParse(text, reviver) {\n try {\n return yaml.safeLoad(text);\n }\n catch (e) {\n if (e instanceof Error) {\n throw e;\n }\n else {\n // https://github.com/nodeca/js-yaml/issues/153\n throw ono(e, e.message);\n }\n }\n },\n\n /**\n * Converts a JavaScript value to a YAML string.\n *\n * @param {*} value - The value to convert to YAML\n * @param {function|array} replacer - Not currently supported. Provided for consistency with {@link JSON.stringify}\n * @param {string|number} space - The number of spaces to use for indentation, or a string containing the number of spaces.\n * @returns {string}\n */\n stringify: function yamlStringify(value, replacer, space) {\n try {\n var indent = (typeof space === 'string' ? space.length : space) || 2;\n return yaml.safeDump(value, {indent: indent});\n }\n catch (e) {\n if (e instanceof Error) {\n throw e;\n }\n else {\n // https://github.com/nodeca/js-yaml/issues/153\n throw ono(e, e.message);\n }\n }\n }\n};\n", - "/**\n * lodash 4.7.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n symbolTag = '[object Symbol]';\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]/g;\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to determine if values are of the language type `Object`. */\nvar objectTypes = {\n 'function': true,\n 'object': true\n};\n\n/** Detect free variable `exports`. */\nvar freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)\n ? exports\n : undefined;\n\n/** Detect free variable `module`. */\nvar freeModule = (objectTypes[typeof module] && module && !module.nodeType)\n ? module\n : undefined;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);\n\n/** Detect free variable `self`. */\nvar freeSelf = checkGlobal(objectTypes[typeof self] && self);\n\n/** Detect free variable `window`. */\nvar freeWindow = checkGlobal(objectTypes[typeof window] && window);\n\n/** Detect `this` as the global object. */\nvar thisGlobal = checkGlobal(objectTypes[typeof this] && this);\n\n/**\n * Used as a reference to the global object.\n *\n * The `this` value is used if it's the global object to avoid Greasemonkey's\n * restricted `window` object, otherwise the `window` object is used.\n */\nvar root = freeGlobal ||\n ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||\n freeSelf || thisGlobal || Function('return this')();\n\n/**\n * Checks if `value` is a global object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {null|Object} Returns `value` if it's a global object, else `null`.\n */\nfunction checkGlobal(value) {\n return (value && value.Object === Object) ? value : null;\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Symbol = root.Symbol,\n splice = arrayProto.splice;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @returns {Object} Returns the new hash object.\n */\nfunction Hash() {}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(hash, key) {\n return hashHas(hash, key) && delete hash[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @param {Object} hash The hash to query.\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(hash, key) {\n if (nativeCreate) {\n var result = hash[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(hash, key) ? hash[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @param {Object} hash The hash to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(hash, key) {\n return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n */\nfunction hashSet(hash, key, value) {\n hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n}\n\n// Avoid inheriting from `Object.prototype` when possible.\nHash.prototype = nativeCreate ? nativeCreate(null) : objectProto;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction MapCache(values) {\n var index = -1,\n length = values ? values.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = values[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapDelete(key) {\n var data = this.__data__;\n if (isKeyable(key)) {\n return hashDelete(typeof key == 'string' ? data.string : data.hash, key);\n }\n return Map ? data.map['delete'](key) : assocDelete(data.map, key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapGet(key) {\n var data = this.__data__;\n if (isKeyable(key)) {\n return hashGet(typeof key == 'string' ? data.string : data.hash, key);\n }\n return Map ? data.map.get(key) : assocGet(data.map, key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapHas(key) {\n var data = this.__data__;\n if (isKeyable(key)) {\n return hashHas(typeof key == 'string' ? data.string : data.hash, key);\n }\n return Map ? data.map.has(key) : assocHas(data.map, key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapSet(key, value) {\n var data = this.__data__;\n if (isKeyable(key)) {\n hashSet(typeof key == 'string' ? data.string : data.hash, key, value);\n } else if (Map) {\n data.map.set(key, value);\n } else {\n assocSet(data.map, key, value);\n }\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapClear;\nMapCache.prototype['delete'] = mapDelete;\nMapCache.prototype.get = mapGet;\nMapCache.prototype.has = mapHas;\nMapCache.prototype.set = mapSet;\n\n/**\n * Removes `key` and its value from the associative array.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction assocDelete(array, key) {\n var index = assocIndexOf(array, key);\n if (index < 0) {\n return false;\n }\n var lastIndex = array.length - 1;\n if (index == lastIndex) {\n array.pop();\n } else {\n splice.call(array, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the associative array value for `key`.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction assocGet(array, key) {\n var index = assocIndexOf(array, key);\n return index < 0 ? undefined : array[index][1];\n}\n\n/**\n * Checks if an associative array value for `key` exists.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction assocHas(array, key) {\n return assocIndexOf(array, key) > -1;\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * Sets the associative array `key` to `value`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n */\nfunction assocSet(array, key, value) {\n var index = assocIndexOf(array, key);\n if (index < 0) {\n array.push([key, value]);\n } else {\n array[index][1] = value;\n }\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return type == 'number' || type == 'boolean' ||\n (type == 'string' && value != '__proto__') || value == null;\n}\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoize(function(string) {\n var result = [];\n toString(string).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoizing function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result);\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Assign cache to `_.memoize`.\nmemoize.Cache = MapCache;\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified,\n * else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array and weak map constructors,\n // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (!isObject(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified,\n * else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (value == null) {\n return '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = stringToPath;\n", - "/**\n * lodash 4.2.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\nvar stringToPath = require('lodash._stringtopath');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast property path array.\n */\nfunction baseCastPath(value) {\n return isArray(value) ? value : stringToPath(value);\n}\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = isKey(path, object) ? [path] : baseCastPath(path);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n}\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n var type = typeof value;\n if (type == 'number' || type == 'symbol') {\n return true;\n }\n return !isArray(value) &&\n (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object)));\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @type {Function}\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified,\n * else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified,\n * else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined` the `defaultValue` is used in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n", + "/**\n * lodash 3.7.2 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n}\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = baseGet;\n", + "/**\n * lodash 3.8.1 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar isArray = require('lodash.isarray');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n return value == null ? '' : (value + '');\n}\n\n/**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\nfunction toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n}\n\nmodule.exports = toPath;\n", + "/**\n * lodash 3.7.0 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar baseGet = require('lodash._baseget'),\n toPath = require('lodash._topath');\n\n/**\n * Gets the property value of `path` on `object`. If the resolved value is\n * `undefined` the `defaultValue` is used in its place.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, toPath(path), path + '');\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n", + "/**\n * lodash 3.0.4 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]',\n funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isArray;\n", "/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} options\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options){\n options = options || {};\n if ('string' == typeof val) return parse(val);\n return options.long\n ? long(val)\n : short(val);\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = '' + str;\n if (str.length > 10000) return;\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);\n if (!match) return;\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction short(ms) {\n if (ms >= d) return Math.round(ms / d) + 'd';\n if (ms >= h) return Math.round(ms / h) + 'h';\n if (ms >= m) return Math.round(ms / m) + 'm';\n if (ms >= s) return Math.round(ms / s) + 's';\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction long(ms) {\n return plural(ms, d, 'day')\n || plural(ms, h, 'hour')\n || plural(ms, m, 'minute')\n || plural(ms, s, 'second')\n || ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) return;\n if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n", - "/**!\n * Ono v2.2.1\n *\n * @link https://github.com/BigstickCarpet/ono\n * @license MIT\n */\n'use strict';\n\nvar util = require('util'),\n slice = Array.prototype.slice,\n vendorSpecificErrorProperties = [\n 'name', 'message', 'description', 'number', 'fileName', 'lineNumber', 'columnNumber',\n 'sourceURL', 'line', 'column', 'stack'\n ];\n\nmodule.exports = create(Error);\nmodule.exports.error = create(Error);\nmodule.exports.eval = create(EvalError);\nmodule.exports.range = create(RangeError);\nmodule.exports.reference = create(ReferenceError);\nmodule.exports.syntax = create(SyntaxError);\nmodule.exports.type = create(TypeError);\nmodule.exports.uri = create(URIError);\nmodule.exports.formatter = util.format;\n\n/**\n * Creates a new {@link ono} function that creates the given Error class.\n *\n * @param {Class} Klass - The Error subclass to create\n * @returns {ono}\n */\nfunction create(Klass) {\n /**\n * @param {Error} [err] - The original error, if any\n * @param {object} [props] - An object whose properties will be added to the error object\n * @param {string} [message] - The error message. May contain {@link util#format} placeholders\n * @param {...*} [params] - Parameters that map to the `message` placeholders\n * @returns {Error}\n */\n return function ono(err, props, message, params) {\n var formattedMessage;\n var formatter = module.exports.formatter;\n\n if (typeof(err) === 'string') {\n formattedMessage = formatter.apply(null, arguments);\n err = props = undefined;\n }\n else if (typeof(props) === 'string') {\n formattedMessage = formatter.apply(null, slice.call(arguments, 1));\n }\n else {\n formattedMessage = formatter.apply(null, slice.call(arguments, 2));\n }\n\n if (!(err instanceof Error)) {\n props = err;\n err = undefined;\n }\n\n if (err) {\n // The inner-error's message will be added to the new message\n formattedMessage += (formattedMessage ? ' \\n' : '') + err.message;\n }\n\n // Create the new error\n // NOTE: DON'T move this to a separate function! We don't want to pollute the stack trace\n var newError = new Klass(formattedMessage);\n\n // Extend the new error with the additional properties\n extendError(newError, err); // Copy properties of the original error\n extendToJSON(newError); // Replace the original toJSON method\n extend(newError, props); // Copy custom properties, possibly including a custom toJSON method\n\n return newError;\n };\n}\n\n/**\n * Extends the targetError with the properties of the source error.\n *\n * @param {Error} targetError - The error object to extend\n * @param {?Error} sourceError - The source error object, if any\n */\nfunction extendError(targetError, sourceError) {\n if (sourceError) {\n extendStack(targetError, sourceError);\n extend(targetError, sourceError, true);\n }\n}\n\n/**\n * JavaScript engines differ in how errors are serialized to JSON - especially when it comes\n * to custom error properties and stack traces. So we add our own toJSON method that ALWAYS\n * outputs every property of the error.\n */\nfunction extendToJSON(error) {\n error.toJSON = errorToJSON;\n\n // Also add an inspect() method, for compatibility with Node.js' `util.inspect()` method\n error.inspect = errorToString;\n}\n\n/**\n * Extends the target object with the properties of the source object.\n *\n * @param {object} target - The object to extend\n * @param {?source} source - The object whose properties are copied\n * @param {boolean} omitVendorSpecificProperties - Skip vendor-specific Error properties\n */\nfunction extend(target, source, omitVendorSpecificProperties) {\n if (source && typeof(source) === 'object') {\n var keys = Object.keys(source);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n // Don't bother trying to copy read-only vendor-specific Error properties\n if (omitVendorSpecificProperties && vendorSpecificErrorProperties.indexOf(key) >= 0) {\n continue;\n }\n\n try {\n target[key] = source[key];\n }\n catch (e) {\n // This property is read-only, so it can't be copied\n }\n }\n }\n}\n\n/**\n * Custom JSON serializer for Error objects.\n * Returns all built-in error properties, as well as extended properties.\n *\n * @returns {object}\n */\nfunction errorToJSON() {\n // jshint -W040\n var json = {};\n\n // Get all the properties of this error\n var keys = Object.keys(this);\n\n // Also include vendor-specific properties from the prototype\n keys = keys.concat(vendorSpecificErrorProperties);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = this[key];\n var type = typeof value;\n if (type !== 'undefined' && type !== 'function') {\n json[key] = value;\n }\n }\n\n return json;\n}\n\n/**\n * Serializes Error objects as human-readable JSON strings for debugging/logging purposes.\n *\n * @returns {string}\n */\nfunction errorToString() {\n // jshint -W040\n return JSON.stringify(this, null, 2).replace(/\\\\n/g, '\\n');\n}\n\n/**\n * Extend the error stack to include its cause\n */\nfunction extendStack(targetError, sourceError) {\n if (hasLazyStack(sourceError)) {\n extendStackProperty(targetError, sourceError);\n }\n else {\n var stack = sourceError.stack;\n if (stack) {\n targetError.stack += ' \\n\\n' + sourceError.stack;\n }\n }\n}\n\n/**\n * Does a one-time determination of whether this JavaScript engine\n * supports lazy `Error.stack` properties.\n */\nvar supportsLazyStack = (function() {\n return !!(\n // ES5 property descriptors must be supported\n Object.getOwnPropertyDescriptor && Object.defineProperty &&\n\n // Chrome on Android doesn't support lazy stacks :(\n (typeof navigator === 'undefined' || !/Android/.test(navigator.userAgent))\n );\n})();\n\n/**\n * Does this error have a lazy stack property?\n *\n * @returns {boolean}\n */\nfunction hasLazyStack(err) {\n if (!supportsLazyStack) {\n return false;\n }\n var descriptor = Object.getOwnPropertyDescriptor(err, 'stack');\n if (!descriptor) {\n return false;\n }\n return typeof descriptor.get === 'function';\n}\n\n/**\n * Extend the error stack to include its cause, lazily\n */\nfunction extendStackProperty(targetError, sourceError) {\n var sourceStack = Object.getOwnPropertyDescriptor(sourceError, 'stack');\n if (sourceStack) {\n var targetStack = Object.getOwnPropertyDescriptor(targetError, 'stack');\n Object.defineProperty(targetError, 'stack', {\n get: function() {\n return targetStack.get.apply(targetError) + ' \\n\\n' + sourceError.stack;\n },\n enumerable: false,\n configurable: true\n });\n }\n}\n", + "/**!\n * Ono v2.0.1\n *\n * @link https://github.com/BigstickCarpet/ono\n * @license MIT\n */\n'use strict';\n\nvar util = require('util'),\n slice = Array.prototype.slice,\n vendorSpecificErrorProperties = [\n 'name', 'message', 'description', 'number', 'fileName', 'lineNumber', 'columnNumber',\n 'sourceURL', 'line', 'column', 'stack'\n ];\n\nmodule.exports = create(Error);\nmodule.exports.error = create(Error);\nmodule.exports.eval = create(EvalError);\nmodule.exports.range = create(RangeError);\nmodule.exports.reference = create(ReferenceError);\nmodule.exports.syntax = create(SyntaxError);\nmodule.exports.type = create(TypeError);\nmodule.exports.uri = create(URIError);\nmodule.exports.formatter = util.format;\n\n/**\n * Creates a new {@link ono} function that creates the given Error class.\n *\n * @param {Class} Klass - The Error subclass to create\n * @returns {ono}\n */\nfunction create(Klass) {\n /**\n * @param {Error} [err] - The original error, if any\n * @param {object} [props] - An object whose properties will be added to the error object\n * @param {string} [message] - The error message. May contain {@link util#format} placeholders\n * @param {...*} [params] - Parameters that map to the `message` placeholders\n * @returns {Error}\n */\n return function ono(err, props, message, params) {\n var formattedMessage, stack;\n var formatter = module.exports.formatter;\n\n if (typeof(err) === 'string') {\n formattedMessage = formatter.apply(null, arguments);\n err = props = undefined;\n }\n else if (typeof(props) === 'string') {\n formattedMessage = formatter.apply(null, slice.call(arguments, 1));\n }\n else {\n formattedMessage = formatter.apply(null, slice.call(arguments, 2));\n }\n\n if (!(err instanceof Error)) {\n props = err;\n err = undefined;\n }\n\n if (err) {\n // The inner-error's message will be added to the new message\n formattedMessage += (formattedMessage ? ' \\n' : '') + err.message;\n }\n\n // Create the new error\n // NOTE: DON'T move this to a separate function! We don't want to pollute the stack trace\n var newError = new Klass(formattedMessage);\n\n // Extend the new error with the additional properties\n extendError(newError, err); // Copy properties of the original error\n extendToJSON(newError); // Replace the original toJSON method\n extend(newError, props); // Copy custom properties, possibly including a custom toJSON method\n\n return newError;\n };\n}\n\n/**\n * Extends the targetError with the properties of the source error.\n *\n * @param {Error} targetError - The error object to extend\n * @param {?Error} sourceError - The source error object, if any\n */\nfunction extendError(targetError, sourceError) {\n if (sourceError) {\n var stack = sourceError.stack;\n if (stack) {\n targetError.stack += ' \\n\\n' + sourceError.stack;\n }\n\n extend(targetError, sourceError, true);\n }\n}\n\n/**\n * JavaScript engines differ in how errors are serialized to JSON - especially when it comes\n * to custom error properties and stack traces. So we add our own toJSON method that ALWAYS\n * outputs every property of the error.\n */\nfunction extendToJSON(error) {\n error.toJSON = errorToJSON;\n\n // Also add an inspect() method, for compatibility with Node.js' `util.inspect()` method\n error.inspect = errorToJSON;\n}\n\n/**\n * Extends the target object with the properties of the source object.\n *\n * @param {object} target - The object to extend\n * @param {?source} source - The object whose properties are copied\n * @param {boolean} omitVendorSpecificProperties - Skip vendor-specific Error properties\n */\nfunction extend(target, source, omitVendorSpecificProperties) {\n if (source && typeof(source) === 'object') {\n var keys = Object.keys(source);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n // Don't bother trying to copy read-only vendor-specific Error properties\n if (omitVendorSpecificProperties && vendorSpecificErrorProperties.indexOf(key) >= 0) {\n continue;\n }\n\n try {\n target[key] = source[key];\n }\n catch (e) {\n // This property is read-only, so it can't be copied\n }\n }\n }\n}\n\n/**\n * Custom JSON serializer for Error objects.\n * Returns all built-in error properties, as well as extended properties.\n *\n * @returns {object}\n */\nfunction errorToJSON() {\n // jshint -W040\n var json = {};\n\n // Get all the properties of this error\n var keys = Object.keys(this);\n\n // Also include vendor-specific properties from the prototype\n keys = keys.concat(vendorSpecificErrorProperties);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = this[key];\n if (value !== undefined) {\n json[key] = value;\n }\n }\n\n return json;\n}\n", "'use strict';\n\nif (!process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = nextTick;\n} else {\n module.exports = process.nextTick;\n}\n\nfunction nextTick(fn) {\n var args = new Array(arguments.length - 1);\n var i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n}\n", "// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n", - "/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n", + "/*! https://mths.be/punycode v1.4.0 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n", "'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n", "module.exports = require(\"./lib/_stream_duplex.js\")\n", - "// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/**/\n\nmodule.exports = Duplex;\n\n/**/\nvar processNextTick = require('process-nextick-args');\n/**/\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nfunction forEach(xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}", - "// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};", - "'use strict';\n\nmodule.exports = Readable;\n\n/**/\nvar processNextTick = require('process-nextick-args');\n/**/\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events');\n\n/**/\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream;\n(function () {\n try {\n Stream = require('st' + 'ream');\n } catch (_) {} finally {\n if (!Stream) Stream = require('events').EventEmitter;\n }\n})();\n/**/\n\nvar Buffer = require('buffer').Buffer;\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar debugUtil = require('util');\nvar debug = undefined;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar Duplex;\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~ ~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nvar Duplex;\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options && typeof options.read === 'function') this._read = options.read;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n\n if (!state.objectMode && typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n var skipAdd;\n if (state.decoder && !addToFront && !encoding) {\n chunk = state.decoder.write(chunk);\n skipAdd = !state.objectMode && chunk.length === 0;\n }\n\n if (!addToFront) state.reading = false;\n\n // Don't add to the buffer if we've decoded to an empty string chunk and\n // we're not in object mode\n if (!skipAdd) {\n // if we want the data now, just emit it.\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n }\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended) return 0;\n\n if (state.objectMode) return n === 0 ? 0 : 1;\n\n if (n === null || isNaN(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;\n }\n\n if (n <= 0) return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else {\n return state.length;\n }\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n var state = this._readableState;\n var nOrig = n;\n\n if (typeof n !== 'number' || n > 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n }\n\n if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (doRead && !state.reading) n = howMuchToRead(nOrig, state);\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended && state.length === 0) endReadable(this);\n\n if (ret !== null) this.emit('data', ret);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n processNextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n debug('onunpipe');\n if (readable === src) {\n cleanup();\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n if (false === ret) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error];\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var _i = 0; _i < len; _i++) {\n dests[_i].emit('unpipe', this);\n }return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1) return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n // If listening to data, and it has not explicitly been paused,\n // then call resume to start the flow of data on the next tick.\n if (ev === 'data' && false !== this._readableState.flowing) {\n this.resume();\n }\n\n if (ev === 'readable' && !this._readableState.endEmitted) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n processNextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n processNextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n if (state.flowing) {\n do {\n var chunk = stream.read();\n } while (null !== chunk && state.flowing);\n }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function (ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0) return null;\n\n if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode) ret = '';else ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n processNextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction forEach(xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}", - "// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction TransformState(stream) {\n this.afterTransform = function (er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n this.writeencoding = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data !== null && data !== undefined) stream.push(data);\n\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = new TransformState(this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n this.once('prefinish', function () {\n if (typeof this._flush === 'function') this._flush(function (er) {\n done(stream, er);\n });else done(stream);\n });\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nfunction done(stream, er) {\n if (er) return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var ts = stream._transformState;\n\n if (ws.length) throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming) throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}", - "// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/**/\nvar processNextTick = require('process-nextick-args');\n/**/\n\n/**/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;\n/**/\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream;\n(function () {\n try {\n Stream = require('st' + 'ream');\n } catch (_) {} finally {\n if (!Stream) Stream = require('events').EventEmitter;\n }\n})();\n/**/\n\nvar Buffer = require('buffer').Buffer;\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\nvar Duplex;\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~ ~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // create the two objects needed to store the corked requests\n // they are not a linked list, as no new elements are inserted in there\n this.corkedRequestsFree = new CorkedRequest(this);\n this.corkedRequestsFree.next = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function writableStateGetBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')\n });\n } catch (_) {}\n})();\n\nvar Duplex;\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n\n if (typeof options.writev === 'function') this._writev = options.writev;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n processNextTick(cb, er);\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n\n if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n\n if (Buffer.isBuffer(chunk)) encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) processNextTick(cb, er);else cb(er);\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /**/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /**/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n while (entry) {\n buffer[count] = entry;\n entry = entry.next;\n count += 1;\n }\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequestCount = 0;\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished) {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n if (state.pendingcb === 0) {\n prefinish(stream, state);\n state.finished = true;\n stream.emit('finish');\n } else {\n prefinish(stream, state);\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) processNextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function (err) {\n var entry = _this.entry;\n _this.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = _this;\n } else {\n state.corkedRequestsFree = _this;\n }\n };\n}", + "// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\nmodule.exports = Duplex;\n\n/**/\nvar processNextTick = require('process-nextick-args');\n/**/\n\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n", + "// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n", + "'use strict';\n\nmodule.exports = Readable;\n\n/**/\nvar processNextTick = require('process-nextick-args');\n/**/\n\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events');\n\n/**/\nvar EElistenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n\n\n/**/\nvar Stream;\n(function (){try{\n Stream = require('st' + 'ream');\n}catch(_){}finally{\n if (!Stream)\n Stream = require('events').EventEmitter;\n}}())\n/**/\n\nvar Buffer = require('buffer').Buffer;\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\n\n\n/**/\nvar debugUtil = require('util');\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar Duplex;\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nvar Duplex;\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options && typeof options.read === 'function')\n this._read = options.read;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (!state.objectMode && typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nReadable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n if (!addToFront)\n state.reading = false;\n\n // if we want the data now, just emit it.\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n\n if (state.needReadable)\n emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (n === null || isNaN(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else {\n return state.length;\n }\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n debug('read', n);\n var state = this._readableState;\n var nOrig = n;\n\n if (typeof n !== 'number' || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n }\n\n if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended && state.length === 0)\n endReadable(this);\n\n if (ret !== null)\n this.emit('data', ret);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!(Buffer.isBuffer(chunk)) &&\n typeof chunk !== 'string' &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n processNextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n processNextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n debug('onunpipe');\n if (readable === src) {\n cleanup();\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain &&\n (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n if (false === ret) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n if (state.pipesCount === 1 &&\n state.pipes[0] === dest &&\n src.listenerCount('data') === 1 &&\n !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n // If listening to data, and it has not explicitly been paused,\n // then call resume to start the flow of data on the next tick.\n if (ev === 'data' && false !== this._readableState.flowing) {\n this.resume();\n }\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n processNextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n processNextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n if (state.flowing) {\n do {\n var chunk = stream.read();\n } while (null !== chunk && state.flowing);\n }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n debug('wrapped data');\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }; }(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else if (list.length === 1)\n ret = list[0];\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n processNextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n", + "// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data !== null && data !== undefined)\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = new TransformState(this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function')\n this._transform = options.transform;\n\n if (typeof options.flush === 'function')\n this._flush = options.flush;\n }\n\n this.once('prefinish', function() {\n if (typeof this._flush === 'function')\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n", + "// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/**/\nvar processNextTick = require('process-nextick-args');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n\n\n/**/\nvar Stream;\n(function (){try{\n Stream = require('st' + 'ream');\n}catch(_){}finally{\n if (!Stream)\n Stream = require('events').EventEmitter;\n}}())\n/**/\n\nvar Buffer = require('buffer').Buffer;\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\nvar Duplex;\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nWritableState.prototype.getBuffer = function writableStateGetBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function (){try {\nObject.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' +\n 'instead.')\n});\n}catch(_){}}());\n\n\nvar Duplex;\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function')\n this._write = options.write;\n\n if (typeof options.writev === 'function')\n this._writev = options.writev;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n processNextTick(cb, er);\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n\n if (!(Buffer.isBuffer(chunk)) &&\n typeof chunk !== 'string' &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function')\n cb = nop;\n\n if (state.ended)\n writeAfterEnd(this, cb);\n else if (validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function() {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function() {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing &&\n !state.corked &&\n !state.finished &&\n !state.bufferProcessing &&\n state.bufferedRequest)\n clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string')\n encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',\n'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']\n.indexOf((encoding + '').toLowerCase()) > -1))\n throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n typeof chunk === 'string') {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync)\n processNextTick(cb, er);\n else\n cb(er);\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished &&\n !state.corked &&\n !state.bufferProcessing &&\n state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n processNextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var buffer = [];\n var cbs = [];\n while (entry) {\n cbs.push(entry.callback);\n buffer.push(entry);\n entry = entry.next;\n }\n\n // count the one we are adding, as well.\n // TODO(isaacs) clean this up\n state.pendingcb++;\n state.lastBufferedRequest = null;\n doWrite(stream, state, true, state.length, buffer, '', function(err) {\n for (var i = 0; i < cbs.length; i++) {\n state.pendingcb--;\n cbs[i](err);\n }\n });\n\n // Clear buffer\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null)\n state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined)\n this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(state) {\n return (state.ending &&\n state.length === 0 &&\n state.bufferedRequest === null &&\n !state.finished &&\n !state.writing);\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished) {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n if (state.pendingcb === 0) {\n prefinish(stream, state);\n state.finished = true;\n stream.emit('finish');\n } else {\n prefinish(stream, state);\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n processNextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n", "module.exports = require(\"./lib/_stream_passthrough.js\")\n", "var Stream = (function (){\n try {\n return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify\n } catch(_){}\n}());\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream || exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n", "module.exports = require(\"./lib/_stream_transform.js\")\n", "module.exports = require(\"./lib/_stream_writable.js\")\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n", - "var ClientRequest = require('./lib/request')\nvar extend = require('xtend')\nvar statusCodes = require('builtin-status-codes')\nvar url = require('url')\n\nvar http = exports\n\nhttp.request = function (opts, cb) {\n\tif (typeof opts === 'string')\n\t\topts = url.parse(opts)\n\telse\n\t\topts = extend(opts)\n\n\t// Normally, the page is loaded from http or https, so not specifying a protocol\n\t// will result in a (valid) protocol-relative url. However, this won't work if\n\t// the protocol is something else, like 'file:'\n\tvar defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''\n\n\tvar protocol = opts.protocol || defaultProtocol\n\tvar host = opts.hostname || opts.host\n\tvar port = opts.port\n\tvar path = opts.path || '/'\n\n\t// Necessary for IPv6 addresses\n\tif (host && host.indexOf(':') !== -1)\n\t\thost = '[' + host + ']'\n\n\t// This may be a relative url. The browser should always be able to interpret it correctly.\n\topts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path\n\topts.method = (opts.method || 'GET').toUpperCase()\n\topts.headers = opts.headers || {}\n\n\t// Also valid opts.auth, opts.mode\n\n\tvar req = new ClientRequest(opts)\n\tif (cb)\n\t\treq.on('response', cb)\n\treturn req\n}\n\nhttp.get = function get (opts, cb) {\n\tvar req = http.request(opts, cb)\n\treq.end()\n\treturn req\n}\n\nhttp.Agent = function () {}\nhttp.Agent.defaultMaxSockets = 4\n\nhttp.STATUS_CODES = statusCodes\n\nhttp.METHODS = [\n\t'CHECKOUT',\n\t'CONNECT',\n\t'COPY',\n\t'DELETE',\n\t'GET',\n\t'HEAD',\n\t'LOCK',\n\t'M-SEARCH',\n\t'MERGE',\n\t'MKACTIVITY',\n\t'MKCOL',\n\t'MOVE',\n\t'NOTIFY',\n\t'OPTIONS',\n\t'PATCH',\n\t'POST',\n\t'PROPFIND',\n\t'PROPPATCH',\n\t'PURGE',\n\t'PUT',\n\t'REPORT',\n\t'SEARCH',\n\t'SUBSCRIBE',\n\t'TRACE',\n\t'UNLOCK',\n\t'UNSUBSCRIBE'\n]", + "var ClientRequest = require('./lib/request')\nvar extend = require('xtend')\nvar statusCodes = require('builtin-status-codes')\nvar url = require('url')\n\nvar http = exports\n\nhttp.request = function (opts, cb) {\n\tif (typeof opts === 'string')\n\t\topts = url.parse(opts)\n\telse\n\t\topts = extend(opts)\n\n\tvar protocol = opts.protocol || ''\n\tvar host = opts.hostname || opts.host\n\tvar port = opts.port\n\tvar path = opts.path || '/'\n\n\t// Necessary for IPv6 addresses\n\tif (host && host.indexOf(':') !== -1)\n\t\thost = '[' + host + ']'\n\n\t// This may be a relative url. The browser should always be able to interpret it correctly.\n\topts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path\n\topts.method = (opts.method || 'GET').toUpperCase()\n\topts.headers = opts.headers || {}\n\n\t// Also valid opts.auth, opts.mode\n\n\tvar req = new ClientRequest(opts)\n\tif (cb)\n\t\treq.on('response', cb)\n\treturn req\n}\n\nhttp.get = function get (opts, cb) {\n\tvar req = http.request(opts, cb)\n\treq.end()\n\treturn req\n}\n\nhttp.Agent = function () {}\nhttp.Agent.defaultMaxSockets = 4\n\nhttp.STATUS_CODES = statusCodes\n\nhttp.METHODS = [\n\t'CHECKOUT',\n\t'CONNECT',\n\t'COPY',\n\t'DELETE',\n\t'GET',\n\t'HEAD',\n\t'LOCK',\n\t'M-SEARCH',\n\t'MERGE',\n\t'MKACTIVITY',\n\t'MKCOL',\n\t'MOVE',\n\t'NOTIFY',\n\t'OPTIONS',\n\t'PATCH',\n\t'POST',\n\t'PROPFIND',\n\t'PROPPATCH',\n\t'PURGE',\n\t'PUT',\n\t'REPORT',\n\t'SEARCH',\n\t'SUBSCRIBE',\n\t'TRACE',\n\t'UNLOCK',\n\t'UNSUBSCRIBE'\n]", "exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableByteStream)\n\nexports.blobConstructor = false\ntry {\n\tnew Blob([new ArrayBuffer(1)])\n\texports.blobConstructor = true\n} catch (e) {}\n\nvar xhr = new global.XMLHttpRequest()\n// If location.host is empty, e.g. if this page/worker was loaded\n// from a Blob, then use example.com to avoid an error\nxhr.open('GET', global.location.host ? '/' : 'https://example.com')\n\nfunction checkTypeSupport (type) {\n\ttry {\n\t\txhr.responseType = type\n\t\treturn xhr.responseType === type\n\t} catch (e) {}\n\treturn false\n}\n\n// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.\n// Safari 7.1 appears to have fixed this bug.\nvar haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined'\nvar haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice)\n\nexports.arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer')\n// These next two tests unavoidably show warnings in Chrome. Since fetch will always\n// be used if it's available, just return false for these to avoid the warnings.\nexports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream')\nexports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer &&\n\tcheckTypeSupport('moz-chunked-arraybuffer')\nexports.overrideMimeType = isFunction(xhr.overrideMimeType)\nexports.vbArray = isFunction(global.VBArray)\n\nfunction isFunction (value) {\n return typeof value === 'function'\n}\n\nxhr = null // Help gc\n", - "// var Base64 = require('Base64')\nvar capability = require('./capability')\nvar inherits = require('inherits')\nvar response = require('./response')\nvar stream = require('stream')\nvar toArrayBuffer = require('to-arraybuffer')\n\nvar IncomingMessage = response.IncomingMessage\nvar rStates = response.readyStates\n\nfunction decideMode (preferBinary) {\n\tif (capability.fetch) {\n\t\treturn 'fetch'\n\t} else if (capability.mozchunkedarraybuffer) {\n\t\treturn 'moz-chunked-arraybuffer'\n\t} else if (capability.msstream) {\n\t\treturn 'ms-stream'\n\t} else if (capability.arraybuffer && preferBinary) {\n\t\treturn 'arraybuffer'\n\t} else if (capability.vbArray && preferBinary) {\n\t\treturn 'text:vbarray'\n\t} else {\n\t\treturn 'text'\n\t}\n}\n\nvar ClientRequest = module.exports = function (opts) {\n\tvar self = this\n\tstream.Writable.call(self)\n\n\tself._opts = opts\n\tself._body = []\n\tself._headers = {}\n\tif (opts.auth)\n\t\tself.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'))\n\tObject.keys(opts.headers).forEach(function (name) {\n\t\tself.setHeader(name, opts.headers[name])\n\t})\n\n\tvar preferBinary\n\tif (opts.mode === 'prefer-streaming') {\n\t\t// If streaming is a high priority but binary compatibility and\n\t\t// the accuracy of the 'content-type' header aren't\n\t\tpreferBinary = false\n\t} else if (opts.mode === 'allow-wrong-content-type') {\n\t\t// If streaming is more important than preserving the 'content-type' header\n\t\tpreferBinary = !capability.overrideMimeType\n\t} else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {\n\t\t// Use binary if text streaming may corrupt data or the content-type header, or for speed\n\t\tpreferBinary = true\n\t} else {\n\t\tthrow new Error('Invalid value for opts.mode')\n\t}\n\tself._mode = decideMode(preferBinary)\n\n\tself.on('finish', function () {\n\t\tself._onFinish()\n\t})\n}\n\ninherits(ClientRequest, stream.Writable)\n\nClientRequest.prototype.setHeader = function (name, value) {\n\tvar self = this\n\tvar lowerName = name.toLowerCase()\n\t// This check is not necessary, but it prevents warnings from browsers about setting unsafe\n\t// headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but\n\t// http-browserify did it, so I will too.\n\tif (unsafeHeaders.indexOf(lowerName) !== -1)\n\t\treturn\n\n\tself._headers[lowerName] = {\n\t\tname: name,\n\t\tvalue: value\n\t}\n}\n\nClientRequest.prototype.getHeader = function (name) {\n\tvar self = this\n\treturn self._headers[name.toLowerCase()].value\n}\n\nClientRequest.prototype.removeHeader = function (name) {\n\tvar self = this\n\tdelete self._headers[name.toLowerCase()]\n}\n\nClientRequest.prototype._onFinish = function () {\n\tvar self = this\n\n\tif (self._destroyed)\n\t\treturn\n\tvar opts = self._opts\n\n\tvar headersObj = self._headers\n\tvar body\n\tif (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') {\n\t\tif (capability.blobConstructor) {\n\t\t\tbody = new global.Blob(self._body.map(function (buffer) {\n\t\t\t\treturn toArrayBuffer(buffer)\n\t\t\t}), {\n\t\t\t\ttype: (headersObj['content-type'] || {}).value || ''\n\t\t\t})\n\t\t} else {\n\t\t\t// get utf8 string\n\t\t\tbody = Buffer.concat(self._body).toString()\n\t\t}\n\t}\n\n\tif (self._mode === 'fetch') {\n\t\tvar headers = Object.keys(headersObj).map(function (name) {\n\t\t\treturn [headersObj[name].name, headersObj[name].value]\n\t\t})\n\n\t\tglobal.fetch(self._opts.url, {\n\t\t\tmethod: self._opts.method,\n\t\t\theaders: headers,\n\t\t\tbody: body,\n\t\t\tmode: 'cors',\n\t\t\tcredentials: opts.withCredentials ? 'include' : 'same-origin'\n\t\t}).then(function (response) {\n\t\t\tself._fetchResponse = response\n\t\t\tself._connect()\n\t\t}, function (reason) {\n\t\t\tself.emit('error', reason)\n\t\t})\n\t} else {\n\t\tvar xhr = self._xhr = new global.XMLHttpRequest()\n\t\ttry {\n\t\t\txhr.open(self._opts.method, self._opts.url, true)\n\t\t} catch (err) {\n\t\t\tprocess.nextTick(function () {\n\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// Can't set responseType on really old browsers\n\t\tif ('responseType' in xhr)\n\t\t\txhr.responseType = self._mode.split(':')[0]\n\n\t\tif ('withCredentials' in xhr)\n\t\t\txhr.withCredentials = !!opts.withCredentials\n\n\t\tif (self._mode === 'text' && 'overrideMimeType' in xhr)\n\t\t\txhr.overrideMimeType('text/plain; charset=x-user-defined')\n\n\t\tObject.keys(headersObj).forEach(function (name) {\n\t\t\txhr.setRequestHeader(headersObj[name].name, headersObj[name].value)\n\t\t})\n\n\t\tself._response = null\n\t\txhr.onreadystatechange = function () {\n\t\t\tswitch (xhr.readyState) {\n\t\t\t\tcase rStates.LOADING:\n\t\t\t\tcase rStates.DONE:\n\t\t\t\t\tself._onXHRProgress()\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Necessary for streaming in Firefox, since xhr.response is ONLY defined\n\t\t// in onprogress, not in onreadystatechange with xhr.readyState = 3\n\t\tif (self._mode === 'moz-chunked-arraybuffer') {\n\t\t\txhr.onprogress = function () {\n\t\t\t\tself._onXHRProgress()\n\t\t\t}\n\t\t}\n\n\t\txhr.onerror = function () {\n\t\t\tif (self._destroyed)\n\t\t\t\treturn\n\t\t\tself.emit('error', new Error('XHR error'))\n\t\t}\n\n\t\ttry {\n\t\t\txhr.send(body)\n\t\t} catch (err) {\n\t\t\tprocess.nextTick(function () {\n\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n}\n\n/**\n * Checks if xhr.status is readable and non-zero, indicating no error.\n * Even though the spec says it should be available in readyState 3,\n * accessing it throws an exception in IE8\n */\nfunction statusValid (xhr) {\n\ttry {\n\t\tvar status = xhr.status\n\t\treturn (status !== null && status !== 0)\n\t} catch (e) {\n\t\treturn false\n\t}\n}\n\nClientRequest.prototype._onXHRProgress = function () {\n\tvar self = this\n\n\tif (!statusValid(self._xhr) || self._destroyed)\n\t\treturn\n\n\tif (!self._response)\n\t\tself._connect()\n\n\tself._response._onXHRProgress()\n}\n\nClientRequest.prototype._connect = function () {\n\tvar self = this\n\n\tif (self._destroyed)\n\t\treturn\n\n\tself._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode)\n\tself.emit('response', self._response)\n}\n\nClientRequest.prototype._write = function (chunk, encoding, cb) {\n\tvar self = this\n\n\tself._body.push(chunk)\n\tcb()\n}\n\nClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {\n\tvar self = this\n\tself._destroyed = true\n\tif (self._response)\n\t\tself._response._destroyed = true\n\tif (self._xhr)\n\t\tself._xhr.abort()\n\t// Currently, there isn't a way to truly abort a fetch.\n\t// If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27\n}\n\nClientRequest.prototype.end = function (data, encoding, cb) {\n\tvar self = this\n\tif (typeof data === 'function') {\n\t\tcb = data\n\t\tdata = undefined\n\t}\n\n\tstream.Writable.prototype.end.call(self, data, encoding, cb)\n}\n\nClientRequest.prototype.flushHeaders = function () {}\nClientRequest.prototype.setTimeout = function () {}\nClientRequest.prototype.setNoDelay = function () {}\nClientRequest.prototype.setSocketKeepAlive = function () {}\n\n// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method\nvar unsafeHeaders = [\n\t'accept-charset',\n\t'accept-encoding',\n\t'access-control-request-headers',\n\t'access-control-request-method',\n\t'connection',\n\t'content-length',\n\t'cookie',\n\t'cookie2',\n\t'date',\n\t'dnt',\n\t'expect',\n\t'host',\n\t'keep-alive',\n\t'origin',\n\t'referer',\n\t'te',\n\t'trailer',\n\t'transfer-encoding',\n\t'upgrade',\n\t'user-agent',\n\t'via'\n]\n", - "var capability = require('./capability')\nvar inherits = require('inherits')\nvar stream = require('stream')\n\nvar rStates = exports.readyStates = {\n\tUNSENT: 0,\n\tOPENED: 1,\n\tHEADERS_RECEIVED: 2,\n\tLOADING: 3,\n\tDONE: 4\n}\n\nvar IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) {\n\tvar self = this\n\tstream.Readable.call(self)\n\n\tself._mode = mode\n\tself.headers = {}\n\tself.rawHeaders = []\n\tself.trailers = {}\n\tself.rawTrailers = []\n\n\t// Fake the 'close' event, but only once 'end' fires\n\tself.on('end', function () {\n\t\t// The nextTick is necessary to prevent the 'request' module from causing an infinite loop\n\t\tprocess.nextTick(function () {\n\t\t\tself.emit('close')\n\t\t})\n\t})\n\n\tif (mode === 'fetch') {\n\t\tself._fetchResponse = response\n\n\t\tself.statusCode = response.status\n\t\tself.statusMessage = response.statusText\n\t\t// backwards compatible version of for ( of ):\n\t\t// for (var ,_i,_it = [Symbol.iterator](); = (_i = _it.next()).value,!_i.done;)\n\t\tfor (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) {\n\t\t\tself.headers[header[0].toLowerCase()] = header[1]\n\t\t\tself.rawHeaders.push(header[0], header[1])\n\t\t}\n\n\t\t// TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed\n\t\tvar reader = response.body.getReader()\n\t\tfunction read () {\n\t\t\treader.read().then(function (result) {\n\t\t\t\tif (self._destroyed)\n\t\t\t\t\treturn\n\t\t\t\tif (result.done) {\n\t\t\t\t\tself.push(null)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tself.push(new Buffer(result.value))\n\t\t\t\tread()\n\t\t\t})\n\t\t}\n\t\tread()\n\n\t} else {\n\t\tself._xhr = xhr\n\t\tself._pos = 0\n\n\t\tself.statusCode = xhr.status\n\t\tself.statusMessage = xhr.statusText\n\t\tvar headers = xhr.getAllResponseHeaders().split(/\\r?\\n/)\n\t\theaders.forEach(function (header) {\n\t\t\tvar matches = header.match(/^([^:]+):\\s*(.*)/)\n\t\t\tif (matches) {\n\t\t\t\tvar key = matches[1].toLowerCase()\n\t\t\t\tif (key === 'set-cookie') {\n\t\t\t\t\tif (self.headers[key] === undefined) {\n\t\t\t\t\t\tself.headers[key] = []\n\t\t\t\t\t}\n\t\t\t\t\tself.headers[key].push(matches[2])\n\t\t\t\t} else if (self.headers[key] !== undefined) {\n\t\t\t\t\tself.headers[key] += ', ' + matches[2]\n\t\t\t\t} else {\n\t\t\t\t\tself.headers[key] = matches[2]\n\t\t\t\t}\n\t\t\t\tself.rawHeaders.push(matches[1], matches[2])\n\t\t\t}\n\t\t})\n\n\t\tself._charset = 'x-user-defined'\n\t\tif (!capability.overrideMimeType) {\n\t\t\tvar mimeType = self.rawHeaders['mime-type']\n\t\t\tif (mimeType) {\n\t\t\t\tvar charsetMatch = mimeType.match(/;\\s*charset=([^;])(;|$)/)\n\t\t\t\tif (charsetMatch) {\n\t\t\t\t\tself._charset = charsetMatch[1].toLowerCase()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!self._charset)\n\t\t\t\tself._charset = 'utf-8' // best guess\n\t\t}\n\t}\n}\n\ninherits(IncomingMessage, stream.Readable)\n\nIncomingMessage.prototype._read = function () {}\n\nIncomingMessage.prototype._onXHRProgress = function () {\n\tvar self = this\n\n\tvar xhr = self._xhr\n\n\tvar response = null\n\tswitch (self._mode) {\n\t\tcase 'text:vbarray': // For IE9\n\t\t\tif (xhr.readyState !== rStates.DONE)\n\t\t\t\tbreak\n\t\t\ttry {\n\t\t\t\t// This fails in IE8\n\t\t\t\tresponse = new global.VBArray(xhr.responseBody).toArray()\n\t\t\t} catch (e) {}\n\t\t\tif (response !== null) {\n\t\t\t\tself.push(new Buffer(response))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Falls through in IE8\t\n\t\tcase 'text':\n\t\t\ttry { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4\n\t\t\t\tresponse = xhr.responseText\n\t\t\t} catch (e) {\n\t\t\t\tself._mode = 'text:vbarray'\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (response.length > self._pos) {\n\t\t\t\tvar newData = response.substr(self._pos)\n\t\t\t\tif (self._charset === 'x-user-defined') {\n\t\t\t\t\tvar buffer = new Buffer(newData.length)\n\t\t\t\t\tfor (var i = 0; i < newData.length; i++)\n\t\t\t\t\t\tbuffer[i] = newData.charCodeAt(i) & 0xff\n\n\t\t\t\t\tself.push(buffer)\n\t\t\t\t} else {\n\t\t\t\t\tself.push(newData, self._charset)\n\t\t\t\t}\n\t\t\t\tself._pos = response.length\n\t\t\t}\n\t\t\tbreak\n\t\tcase 'arraybuffer':\n\t\t\tif (xhr.readyState !== rStates.DONE)\n\t\t\t\tbreak\n\t\t\tresponse = xhr.response\n\t\t\tself.push(new Buffer(new Uint8Array(response)))\n\t\t\tbreak\n\t\tcase 'moz-chunked-arraybuffer': // take whole\n\t\t\tresponse = xhr.response\n\t\t\tif (xhr.readyState !== rStates.LOADING || !response)\n\t\t\t\tbreak\n\t\t\tself.push(new Buffer(new Uint8Array(response)))\n\t\t\tbreak\n\t\tcase 'ms-stream':\n\t\t\tresponse = xhr.response\n\t\t\tif (xhr.readyState !== rStates.LOADING)\n\t\t\t\tbreak\n\t\t\tvar reader = new global.MSStreamReader()\n\t\t\treader.onprogress = function () {\n\t\t\t\tif (reader.result.byteLength > self._pos) {\n\t\t\t\t\tself.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))))\n\t\t\t\t\tself._pos = reader.result.byteLength\n\t\t\t\t}\n\t\t\t}\n\t\t\treader.onload = function () {\n\t\t\t\tself.push(null)\n\t\t\t}\n\t\t\t// reader.onerror = ??? // TODO: this\n\t\t\treader.readAsArrayBuffer(response)\n\t\t\tbreak\n\t}\n\n\t// The ms-stream case handles end separately in reader.onload()\n\tif (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {\n\t\tself.push(null)\n\t}\n}\n", + "// var Base64 = require('Base64')\nvar capability = require('./capability')\nvar inherits = require('inherits')\nvar response = require('./response')\nvar stream = require('stream')\n\nvar IncomingMessage = response.IncomingMessage\nvar rStates = response.readyStates\n\nfunction decideMode (preferBinary) {\n\tif (capability.fetch) {\n\t\treturn 'fetch'\n\t} else if (capability.mozchunkedarraybuffer) {\n\t\treturn 'moz-chunked-arraybuffer'\n\t} else if (capability.msstream) {\n\t\treturn 'ms-stream'\n\t} else if (capability.arraybuffer && preferBinary) {\n\t\treturn 'arraybuffer'\n\t} else if (capability.vbArray && preferBinary) {\n\t\treturn 'text:vbarray'\n\t} else {\n\t\treturn 'text'\n\t}\n}\n\nvar ClientRequest = module.exports = function (opts) {\n\tvar self = this\n\tstream.Writable.call(self)\n\n\tself._opts = opts\n\tself._body = []\n\tself._headers = {}\n\tif (opts.auth)\n\t\tself.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'))\n\tObject.keys(opts.headers).forEach(function (name) {\n\t\tself.setHeader(name, opts.headers[name])\n\t})\n\n\tvar preferBinary\n\tif (opts.mode === 'prefer-streaming') {\n\t\t// If streaming is a high priority but binary compatibility and\n\t\t// the accuracy of the 'content-type' header aren't\n\t\tpreferBinary = false\n\t} else if (opts.mode === 'allow-wrong-content-type') {\n\t\t// If streaming is more important than preserving the 'content-type' header\n\t\tpreferBinary = !capability.overrideMimeType\n\t} else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {\n\t\t// Use binary if text streaming may corrupt data or the content-type header, or for speed\n\t\tpreferBinary = true\n\t} else {\n\t\tthrow new Error('Invalid value for opts.mode')\n\t}\n\tself._mode = decideMode(preferBinary)\n\n\tself.on('finish', function () {\n\t\tself._onFinish()\n\t})\n}\n\ninherits(ClientRequest, stream.Writable)\n\nClientRequest.prototype.setHeader = function (name, value) {\n\tvar self = this\n\tvar lowerName = name.toLowerCase()\n\t// This check is not necessary, but it prevents warnings from browsers about setting unsafe\n\t// headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but\n\t// http-browserify did it, so I will too.\n\tif (unsafeHeaders.indexOf(lowerName) !== -1)\n\t\treturn\n\n\tself._headers[lowerName] = {\n\t\tname: name,\n\t\tvalue: value\n\t}\n}\n\nClientRequest.prototype.getHeader = function (name) {\n\tvar self = this\n\treturn self._headers[name.toLowerCase()].value\n}\n\nClientRequest.prototype.removeHeader = function (name) {\n\tvar self = this\n\tdelete self._headers[name.toLowerCase()]\n}\n\nClientRequest.prototype._onFinish = function () {\n\tvar self = this\n\n\tif (self._destroyed)\n\t\treturn\n\tvar opts = self._opts\n\n\tvar headersObj = self._headers\n\tvar body\n\tif (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') {\n\t\tif (capability.blobConstructor) {\n\t\t\tbody = new global.Blob(self._body.map(function (buffer) {\n\t\t\t\treturn buffer.toArrayBuffer()\n\t\t\t}), {\n\t\t\t\ttype: (headersObj['content-type'] || {}).value || ''\n\t\t\t})\n\t\t} else {\n\t\t\t// get utf8 string\n\t\t\tbody = Buffer.concat(self._body).toString()\n\t\t}\n\t}\n\n\tif (self._mode === 'fetch') {\n\t\tvar headers = Object.keys(headersObj).map(function (name) {\n\t\t\treturn [headersObj[name].name, headersObj[name].value]\n\t\t})\n\n\t\tglobal.fetch(self._opts.url, {\n\t\t\tmethod: self._opts.method,\n\t\t\theaders: headers,\n\t\t\tbody: body,\n\t\t\tmode: 'cors',\n\t\t\tcredentials: opts.withCredentials ? 'include' : 'same-origin'\n\t\t}).then(function (response) {\n\t\t\tself._fetchResponse = response\n\t\t\tself._connect()\n\t\t}, function (reason) {\n\t\t\tself.emit('error', reason)\n\t\t})\n\t} else {\n\t\tvar xhr = self._xhr = new global.XMLHttpRequest()\n\t\ttry {\n\t\t\txhr.open(self._opts.method, self._opts.url, true)\n\t\t} catch (err) {\n\t\t\tprocess.nextTick(function () {\n\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// Can't set responseType on really old browsers\n\t\tif ('responseType' in xhr)\n\t\t\txhr.responseType = self._mode.split(':')[0]\n\n\t\tif ('withCredentials' in xhr)\n\t\t\txhr.withCredentials = !!opts.withCredentials\n\n\t\tif (self._mode === 'text' && 'overrideMimeType' in xhr)\n\t\t\txhr.overrideMimeType('text/plain; charset=x-user-defined')\n\n\t\tObject.keys(headersObj).forEach(function (name) {\n\t\t\txhr.setRequestHeader(headersObj[name].name, headersObj[name].value)\n\t\t})\n\n\t\tself._response = null\n\t\txhr.onreadystatechange = function () {\n\t\t\tswitch (xhr.readyState) {\n\t\t\t\tcase rStates.LOADING:\n\t\t\t\tcase rStates.DONE:\n\t\t\t\t\tself._onXHRProgress()\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Necessary for streaming in Firefox, since xhr.response is ONLY defined\n\t\t// in onprogress, not in onreadystatechange with xhr.readyState = 3\n\t\tif (self._mode === 'moz-chunked-arraybuffer') {\n\t\t\txhr.onprogress = function () {\n\t\t\t\tself._onXHRProgress()\n\t\t\t}\n\t\t}\n\n\t\txhr.onerror = function () {\n\t\t\tif (self._destroyed)\n\t\t\t\treturn\n\t\t\tself.emit('error', new Error('XHR error'))\n\t\t}\n\n\t\ttry {\n\t\t\txhr.send(body)\n\t\t} catch (err) {\n\t\t\tprocess.nextTick(function () {\n\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n}\n\n/**\n * Checks if xhr.status is readable. Even though the spec says it should\n * be available in readyState 3, accessing it throws an exception in IE8\n */\nfunction statusValid (xhr) {\n\ttry {\n\t\treturn (xhr.status !== null)\n\t} catch (e) {\n\t\treturn false\n\t}\n}\n\nClientRequest.prototype._onXHRProgress = function () {\n\tvar self = this\n\n\tif (!statusValid(self._xhr) || self._destroyed)\n\t\treturn\n\n\tif (!self._response)\n\t\tself._connect()\n\n\tself._response._onXHRProgress()\n}\n\nClientRequest.prototype._connect = function () {\n\tvar self = this\n\n\tif (self._destroyed)\n\t\treturn\n\n\tself._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode)\n\tself.emit('response', self._response)\n}\n\nClientRequest.prototype._write = function (chunk, encoding, cb) {\n\tvar self = this\n\n\tself._body.push(chunk)\n\tcb()\n}\n\nClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {\n\tvar self = this\n\tself._destroyed = true\n\tif (self._response)\n\t\tself._response._destroyed = true\n\tif (self._xhr)\n\t\tself._xhr.abort()\n\t// Currently, there isn't a way to truly abort a fetch.\n\t// If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27\n}\n\nClientRequest.prototype.end = function (data, encoding, cb) {\n\tvar self = this\n\tif (typeof data === 'function') {\n\t\tcb = data\n\t\tdata = undefined\n\t}\n\n\tstream.Writable.prototype.end.call(self, data, encoding, cb)\n}\n\nClientRequest.prototype.flushHeaders = function () {}\nClientRequest.prototype.setTimeout = function () {}\nClientRequest.prototype.setNoDelay = function () {}\nClientRequest.prototype.setSocketKeepAlive = function () {}\n\n// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method\nvar unsafeHeaders = [\n\t'accept-charset',\n\t'accept-encoding',\n\t'access-control-request-headers',\n\t'access-control-request-method',\n\t'connection',\n\t'content-length',\n\t'cookie',\n\t'cookie2',\n\t'date',\n\t'dnt',\n\t'expect',\n\t'host',\n\t'keep-alive',\n\t'origin',\n\t'referer',\n\t'te',\n\t'trailer',\n\t'transfer-encoding',\n\t'upgrade',\n\t'user-agent',\n\t'via'\n]\n", + "var capability = require('./capability')\nvar inherits = require('inherits')\nvar stream = require('stream')\n\nvar rStates = exports.readyStates = {\n\tUNSENT: 0,\n\tOPENED: 1,\n\tHEADERS_RECEIVED: 2,\n\tLOADING: 3,\n\tDONE: 4\n}\n\nvar IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) {\n\tvar self = this\n\tstream.Readable.call(self)\n\n\tself._mode = mode\n\tself.headers = {}\n\tself.rawHeaders = []\n\tself.trailers = {}\n\tself.rawTrailers = []\n\n\t// Fake the 'close' event, but only once 'end' fires\n\tself.on('end', function () {\n\t\t// The nextTick is necessary to prevent the 'request' module from causing an infinite loop\n\t\tprocess.nextTick(function () {\n\t\t\tself.emit('close')\n\t\t})\n\t})\n\n\tif (mode === 'fetch') {\n\t\tself._fetchResponse = response\n\n\t\tself.statusCode = response.status\n\t\tself.statusMessage = response.statusText\n\t\t// backwards compatible version of for ( of ):\n\t\t// for (var ,_i,_it = [Symbol.iterator](); = (_i = _it.next()).value,!_i.done;)\n\t\tfor (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) {\n\t\t\tself.headers[header[0].toLowerCase()] = header[1]\n\t\t\tself.rawHeaders.push(header[0], header[1])\n\t\t}\n\n\t\t// TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed\n\t\tvar reader = response.body.getReader()\n\t\tfunction read () {\n\t\t\treader.read().then(function (result) {\n\t\t\t\tif (self._destroyed)\n\t\t\t\t\treturn\n\t\t\t\tif (result.done) {\n\t\t\t\t\tself.push(null)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tself.push(new Buffer(result.value))\n\t\t\t\tread()\n\t\t\t})\n\t\t}\n\t\tread()\n\n\t} else {\n\t\tself._xhr = xhr\n\t\tself._pos = 0\n\n\t\tself.statusCode = xhr.status\n\t\tself.statusMessage = xhr.statusText\n\t\tvar headers = xhr.getAllResponseHeaders().split(/\\r?\\n/)\n\t\theaders.forEach(function (header) {\n\t\t\tvar matches = header.match(/^([^:]+):\\s*(.*)/)\n\t\t\tif (matches) {\n\t\t\t\tvar key = matches[1].toLowerCase()\n\t\t\t\tif (self.headers[key] !== undefined)\n\t\t\t\t\tself.headers[key] += ', ' + matches[2]\n\t\t\t\telse\n\t\t\t\t\tself.headers[key] = matches[2]\n\t\t\t\tself.rawHeaders.push(matches[1], matches[2])\n\t\t\t}\n\t\t})\n\n\t\tself._charset = 'x-user-defined'\n\t\tif (!capability.overrideMimeType) {\n\t\t\tvar mimeType = self.rawHeaders['mime-type']\n\t\t\tif (mimeType) {\n\t\t\t\tvar charsetMatch = mimeType.match(/;\\s*charset=([^;])(;|$)/)\n\t\t\t\tif (charsetMatch) {\n\t\t\t\t\tself._charset = charsetMatch[1].toLowerCase()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!self._charset)\n\t\t\t\tself._charset = 'utf-8' // best guess\n\t\t}\n\t}\n}\n\ninherits(IncomingMessage, stream.Readable)\n\nIncomingMessage.prototype._read = function () {}\n\nIncomingMessage.prototype._onXHRProgress = function () {\n\tvar self = this\n\n\tvar xhr = self._xhr\n\n\tvar response = null\n\tswitch (self._mode) {\n\t\tcase 'text:vbarray': // For IE9\n\t\t\tif (xhr.readyState !== rStates.DONE)\n\t\t\t\tbreak\n\t\t\ttry {\n\t\t\t\t// This fails in IE8\n\t\t\t\tresponse = new global.VBArray(xhr.responseBody).toArray()\n\t\t\t} catch (e) {}\n\t\t\tif (response !== null) {\n\t\t\t\tself.push(new Buffer(response))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Falls through in IE8\t\n\t\tcase 'text':\n\t\t\ttry { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4\n\t\t\t\tresponse = xhr.responseText\n\t\t\t} catch (e) {\n\t\t\t\tself._mode = 'text:vbarray'\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (response.length > self._pos) {\n\t\t\t\tvar newData = response.substr(self._pos)\n\t\t\t\tif (self._charset === 'x-user-defined') {\n\t\t\t\t\tvar buffer = new Buffer(newData.length)\n\t\t\t\t\tfor (var i = 0; i < newData.length; i++)\n\t\t\t\t\t\tbuffer[i] = newData.charCodeAt(i) & 0xff\n\n\t\t\t\t\tself.push(buffer)\n\t\t\t\t} else {\n\t\t\t\t\tself.push(newData, self._charset)\n\t\t\t\t}\n\t\t\t\tself._pos = response.length\n\t\t\t}\n\t\t\tbreak\n\t\tcase 'arraybuffer':\n\t\t\tif (xhr.readyState !== rStates.DONE)\n\t\t\t\tbreak\n\t\t\tresponse = xhr.response\n\t\t\tself.push(new Buffer(new Uint8Array(response)))\n\t\t\tbreak\n\t\tcase 'moz-chunked-arraybuffer': // take whole\n\t\t\tresponse = xhr.response\n\t\t\tif (xhr.readyState !== rStates.LOADING || !response)\n\t\t\t\tbreak\n\t\t\tself.push(new Buffer(new Uint8Array(response)))\n\t\t\tbreak\n\t\tcase 'ms-stream':\n\t\t\tresponse = xhr.response\n\t\t\tif (xhr.readyState !== rStates.LOADING)\n\t\t\t\tbreak\n\t\t\tvar reader = new global.MSStreamReader()\n\t\t\treader.onprogress = function () {\n\t\t\t\tif (reader.result.byteLength > self._pos) {\n\t\t\t\t\tself.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))))\n\t\t\t\t\tself._pos = reader.result.byteLength\n\t\t\t\t}\n\t\t\t}\n\t\t\treader.onload = function () {\n\t\t\t\tself.push(null)\n\t\t\t}\n\t\t\t// reader.onerror = ??? // TODO: this\n\t\t\treader.readAsArrayBuffer(response)\n\t\t\tbreak\n\t}\n\n\t// The ms-stream case handles end separately in reader.onload()\n\tif (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {\n\t\tself.push(null)\n\t}\n}\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar Buffer = require('buffer').Buffer;\n\nvar isBufferEncoding = Buffer.isEncoding\n || function(encoding) {\n switch (encoding && encoding.toLowerCase()) {\n case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;\n default: return false;\n }\n }\n\n\nfunction assertEncoding(encoding) {\n if (encoding && !isBufferEncoding(encoding)) {\n throw new Error('Unknown encoding: ' + encoding);\n }\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters. CESU-8 is handled as part of the UTF-8 encoding.\n//\n// @TODO Handling all encodings inside a single object makes it very difficult\n// to reason about this code, so it should be split up in the future.\n// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code\n// points as used by CESU-8.\nvar StringDecoder = exports.StringDecoder = function(encoding) {\n this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\n assertEncoding(encoding);\n switch (this.encoding) {\n case 'utf8':\n // CESU-8 represents each of Surrogate Pair by 3-bytes\n this.surrogateSize = 3;\n break;\n case 'ucs2':\n case 'utf16le':\n // UTF-16 represents each of Surrogate Pair by 2-bytes\n this.surrogateSize = 2;\n this.detectIncompleteChar = utf16DetectIncompleteChar;\n break;\n case 'base64':\n // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\n this.surrogateSize = 3;\n this.detectIncompleteChar = base64DetectIncompleteChar;\n break;\n default:\n this.write = passThroughWrite;\n return;\n }\n\n // Enough space to store all bytes of a single character. UTF-8 needs 4\n // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).\n this.charBuffer = new Buffer(6);\n // Number of bytes received for the current incomplete multi-byte character.\n this.charReceived = 0;\n // Number of bytes expected for the current incomplete multi-byte character.\n this.charLength = 0;\n};\n\n\n// write decodes the given buffer and returns it as JS string that is\n// guaranteed to not contain any partial multi-byte characters. Any partial\n// character found at the end of the buffer is buffered up, and will be\n// returned when calling write again with the remaining bytes.\n//\n// Note: Converting a Buffer containing an orphan surrogate to a String\n// currently works, but converting a String to a Buffer (via `new Buffer`, or\n// Buffer#write) will replace incomplete surrogates with the unicode\n// replacement character. See https://codereview.chromium.org/121173009/ .\nStringDecoder.prototype.write = function(buffer) {\n var charStr = '';\n // if our last write ended with an incomplete multibyte character\n while (this.charLength) {\n // determine how many remaining bytes this buffer has to offer for this char\n var available = (buffer.length >= this.charLength - this.charReceived) ?\n this.charLength - this.charReceived :\n buffer.length;\n\n // add the new bytes to the char buffer\n buffer.copy(this.charBuffer, this.charReceived, 0, available);\n this.charReceived += available;\n\n if (this.charReceived < this.charLength) {\n // still not enough chars in this buffer? wait for more ...\n return '';\n }\n\n // remove bytes belonging to the current character from the buffer\n buffer = buffer.slice(available, buffer.length);\n\n // get the character that was split\n charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\n\n // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n var charCode = charStr.charCodeAt(charStr.length - 1);\n if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n this.charLength += this.surrogateSize;\n charStr = '';\n continue;\n }\n this.charReceived = this.charLength = 0;\n\n // if there are no more bytes in this buffer, just emit our char\n if (buffer.length === 0) {\n return charStr;\n }\n break;\n }\n\n // determine and set charLength / charReceived\n this.detectIncompleteChar(buffer);\n\n var end = buffer.length;\n if (this.charLength) {\n // buffer the incomplete character bytes we got\n buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);\n end -= this.charReceived;\n }\n\n charStr += buffer.toString(this.encoding, 0, end);\n\n var end = charStr.length - 1;\n var charCode = charStr.charCodeAt(end);\n // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n var size = this.surrogateSize;\n this.charLength += size;\n this.charReceived += size;\n this.charBuffer.copy(this.charBuffer, size, 0, size);\n buffer.copy(this.charBuffer, 0, 0, size);\n return charStr.substring(0, end);\n }\n\n // or just emit the charStr\n return charStr;\n};\n\n// detectIncompleteChar determines if there is an incomplete UTF-8 character at\n// the end of the given buffer. If so, it sets this.charLength to the byte\n// length that character, and sets this.charReceived to the number of bytes\n// that are available for this character.\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\n // determine how many bytes we have to check at the end of this buffer\n var i = (buffer.length >= 3) ? 3 : buffer.length;\n\n // Figure out if one of the last i bytes of our buffer announces an\n // incomplete char.\n for (; i > 0; i--) {\n var c = buffer[buffer.length - i];\n\n // See http://en.wikipedia.org/wiki/UTF-8#Description\n\n // 110XXXXX\n if (i == 1 && c >> 5 == 0x06) {\n this.charLength = 2;\n break;\n }\n\n // 1110XXXX\n if (i <= 2 && c >> 4 == 0x0E) {\n this.charLength = 3;\n break;\n }\n\n // 11110XXX\n if (i <= 3 && c >> 3 == 0x1E) {\n this.charLength = 4;\n break;\n }\n }\n this.charReceived = i;\n};\n\nStringDecoder.prototype.end = function(buffer) {\n var res = '';\n if (buffer && buffer.length)\n res = this.write(buffer);\n\n if (this.charReceived) {\n var cr = this.charReceived;\n var buf = this.charBuffer;\n var enc = this.encoding;\n res += buf.slice(0, cr).toString(enc);\n }\n\n return res;\n};\n\nfunction passThroughWrite(buffer) {\n return buffer.toString(this.encoding);\n}\n\nfunction utf16DetectIncompleteChar(buffer) {\n this.charReceived = buffer.length % 2;\n this.charLength = this.charReceived ? 2 : 0;\n}\n\nfunction base64DetectIncompleteChar(buffer) {\n this.charReceived = buffer.length % 3;\n this.charLength = this.charReceived ? 3 : 0;\n}\n", "module.exports = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];\n", "module.exports={\n \"title\": \"A JSON Schema for Swagger 2.0 API.\",\n \"id\": \"http://swagger.io/v2/schema.json#\",\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"required\": [\n \"swagger\",\n \"info\",\n \"paths\"\n ],\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"swagger\": {\n \"type\": \"string\",\n \"enum\": [\n \"2.0\"\n ],\n \"description\": \"The Swagger version of this document.\"\n },\n \"info\": {\n \"$ref\": \"#/definitions/info\"\n },\n \"host\": {\n \"type\": \"string\",\n \"pattern\": \"^[^{}/ :\\\\\\\\]+(?::\\\\d+)?$\",\n \"description\": \"The host (name or ip) of the API. Example: 'swagger.io'\"\n },\n \"basePath\": {\n \"type\": \"string\",\n \"pattern\": \"^/\",\n \"description\": \"The base path to the API. Example: '/api'.\"\n },\n \"schemes\": {\n \"$ref\": \"#/definitions/schemesList\"\n },\n \"consumes\": {\n \"description\": \"A list of MIME types accepted by the API.\",\n \"$ref\": \"#/definitions/mediaTypeList\"\n },\n \"produces\": {\n \"description\": \"A list of MIME types the API can produce.\",\n \"$ref\": \"#/definitions/mediaTypeList\"\n },\n \"paths\": {\n \"$ref\": \"#/definitions/paths\"\n },\n \"definitions\": {\n \"$ref\": \"#/definitions/definitions\"\n },\n \"parameters\": {\n \"$ref\": \"#/definitions/parameterDefinitions\"\n },\n \"responses\": {\n \"$ref\": \"#/definitions/responseDefinitions\"\n },\n \"security\": {\n \"$ref\": \"#/definitions/security\"\n },\n \"securityDefinitions\": {\n \"$ref\": \"#/definitions/securityDefinitions\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/tag\"\n },\n \"uniqueItems\": true\n },\n \"externalDocs\": {\n \"$ref\": \"#/definitions/externalDocs\"\n }\n },\n \"definitions\": {\n \"info\": {\n \"type\": \"object\",\n \"description\": \"General information about the API.\",\n \"required\": [\n \"version\",\n \"title\"\n ],\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"description\": \"A unique and precise title of the API.\"\n },\n \"version\": {\n \"type\": \"string\",\n \"description\": \"A semantic version number of the API.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.\"\n },\n \"termsOfService\": {\n \"type\": \"string\",\n \"description\": \"The terms of service for the API.\"\n },\n \"contact\": {\n \"$ref\": \"#/definitions/contact\"\n },\n \"license\": {\n \"$ref\": \"#/definitions/license\"\n }\n }\n },\n \"contact\": {\n \"type\": \"object\",\n \"description\": \"Contact information for the owners of the API.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The identifying name of the contact person/organization.\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"The URL pointing to the contact information.\",\n \"format\": \"uri\"\n },\n \"email\": {\n \"type\": \"string\",\n \"description\": \"The email address of the contact person/organization.\",\n \"format\": \"email\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"license\": {\n \"type\": \"object\",\n \"required\": [\n \"name\"\n ],\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the license type. It's encouraged to use an OSI compatible license.\"\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"The URL pointing to the license.\",\n \"format\": \"uri\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"paths\": {\n \"type\": \"object\",\n \"description\": \"Relative paths to the individual endpoints. They must be relative to the 'basePath'.\",\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n },\n \"^/\": {\n \"$ref\": \"#/definitions/pathItem\"\n }\n },\n \"additionalProperties\": false\n },\n \"definitions\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/schema\"\n },\n \"description\": \"One or more JSON objects describing the schemas being consumed and produced by the API.\"\n },\n \"parameterDefinitions\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/parameter\"\n },\n \"description\": \"One or more JSON representations for parameters\"\n },\n \"responseDefinitions\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/response\"\n },\n \"description\": \"One or more JSON representations for parameters\"\n },\n \"externalDocs\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"information about external documentation\",\n \"required\": [\n \"url\"\n ],\n \"properties\": {\n \"description\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"examples\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n },\n \"mimeType\": {\n \"type\": \"string\",\n \"description\": \"The MIME type of the HTTP message.\"\n },\n \"operation\": {\n \"type\": \"object\",\n \"required\": [\n \"responses\"\n ],\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"uniqueItems\": true\n },\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"A brief summary of the operation.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A longer description of the operation, GitHub Flavored Markdown is allowed.\"\n },\n \"externalDocs\": {\n \"$ref\": \"#/definitions/externalDocs\"\n },\n \"operationId\": {\n \"type\": \"string\",\n \"description\": \"A unique identifier of the operation.\"\n },\n \"produces\": {\n \"description\": \"A list of MIME types the API can produce.\",\n \"$ref\": \"#/definitions/mediaTypeList\"\n },\n \"consumes\": {\n \"description\": \"A list of MIME types the API can consume.\",\n \"$ref\": \"#/definitions/mediaTypeList\"\n },\n \"parameters\": {\n \"$ref\": \"#/definitions/parametersList\"\n },\n \"responses\": {\n \"$ref\": \"#/definitions/responses\"\n },\n \"schemes\": {\n \"$ref\": \"#/definitions/schemesList\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"security\": {\n \"$ref\": \"#/definitions/security\"\n }\n }\n },\n \"pathItem\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"$ref\": {\n \"type\": \"string\"\n },\n \"get\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"put\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"post\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"delete\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"head\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"patch\": {\n \"$ref\": \"#/definitions/operation\"\n },\n \"parameters\": {\n \"$ref\": \"#/definitions/parametersList\"\n }\n }\n },\n \"responses\": {\n \"type\": \"object\",\n \"description\": \"Response objects names can either be any valid HTTP status code or 'default'.\",\n \"minProperties\": 1,\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^([0-9]{3})$|^(default)$\": {\n \"$ref\": \"#/definitions/responseValue\"\n },\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"not\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n }\n },\n \"responseValue\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/definitions/response\"\n },\n {\n \"$ref\": \"#/definitions/jsonReference\"\n }\n ]\n },\n \"response\": {\n \"type\": \"object\",\n \"required\": [\n \"description\"\n ],\n \"properties\": {\n \"description\": {\n \"type\": \"string\"\n },\n \"schema\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/definitions/schema\"\n },\n {\n \"$ref\": \"#/definitions/fileSchema\"\n }\n ]\n },\n \"headers\": {\n \"$ref\": \"#/definitions/headers\"\n },\n \"examples\": {\n \"$ref\": \"#/definitions/examples\"\n }\n },\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"headers\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/header\"\n }\n },\n \"header\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"string\",\n \"number\",\n \"integer\",\n \"boolean\",\n \"array\"\n ]\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"items\": {\n \"$ref\": \"#/definitions/primitivesItems\"\n },\n \"collectionFormat\": {\n \"$ref\": \"#/definitions/collectionFormat\"\n },\n \"default\": {\n \"$ref\": \"#/definitions/default\"\n },\n \"maximum\": {\n \"$ref\": \"#/definitions/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"#/definitions/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"#/definitions/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"#/definitions/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"#/definitions/maxLength\"\n },\n \"minLength\": {\n \"$ref\": \"#/definitions/minLength\"\n },\n \"pattern\": {\n \"$ref\": \"#/definitions/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"#/definitions/maxItems\"\n },\n \"minItems\": {\n \"$ref\": \"#/definitions/minItems\"\n },\n \"uniqueItems\": {\n \"$ref\": \"#/definitions/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"#/definitions/enum\"\n },\n \"multipleOf\": {\n \"$ref\": \"#/definitions/multipleOf\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"vendorExtension\": {\n \"description\": \"Any property starting with x- is valid.\",\n \"additionalProperties\": true,\n \"additionalItems\": true\n },\n \"bodyParameter\": {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"in\",\n \"schema\"\n ],\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the parameter.\"\n },\n \"in\": {\n \"type\": \"string\",\n \"description\": \"Determines the location of the parameter.\",\n \"enum\": [\n \"body\"\n ]\n },\n \"required\": {\n \"type\": \"boolean\",\n \"description\": \"Determines whether or not this parameter is required or optional.\",\n \"default\": false\n },\n \"schema\": {\n \"$ref\": \"#/definitions/schema\"\n }\n },\n \"additionalProperties\": false\n },\n \"headerParameterSubSchema\": {\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"required\": {\n \"type\": \"boolean\",\n \"description\": \"Determines whether or not this parameter is required or optional.\",\n \"default\": false\n },\n \"in\": {\n \"type\": \"string\",\n \"description\": \"Determines the location of the parameter.\",\n \"enum\": [\n \"header\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the parameter.\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"integer\",\n \"array\"\n ]\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"items\": {\n \"$ref\": \"#/definitions/primitivesItems\"\n },\n \"collectionFormat\": {\n \"$ref\": \"#/definitions/collectionFormat\"\n },\n \"default\": {\n \"$ref\": \"#/definitions/default\"\n },\n \"maximum\": {\n \"$ref\": \"#/definitions/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"#/definitions/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"#/definitions/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"#/definitions/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"#/definitions/maxLength\"\n },\n \"minLength\": {\n \"$ref\": \"#/definitions/minLength\"\n },\n \"pattern\": {\n \"$ref\": \"#/definitions/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"#/definitions/maxItems\"\n },\n \"minItems\": {\n \"$ref\": \"#/definitions/minItems\"\n },\n \"uniqueItems\": {\n \"$ref\": \"#/definitions/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"#/definitions/enum\"\n },\n \"multipleOf\": {\n \"$ref\": \"#/definitions/multipleOf\"\n }\n }\n },\n \"queryParameterSubSchema\": {\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"required\": {\n \"type\": \"boolean\",\n \"description\": \"Determines whether or not this parameter is required or optional.\",\n \"default\": false\n },\n \"in\": {\n \"type\": \"string\",\n \"description\": \"Determines the location of the parameter.\",\n \"enum\": [\n \"query\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the parameter.\"\n },\n \"allowEmptyValue\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"allows sending a parameter by name only or with an empty value.\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"integer\",\n \"array\"\n ]\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"items\": {\n \"$ref\": \"#/definitions/primitivesItems\"\n },\n \"collectionFormat\": {\n \"$ref\": \"#/definitions/collectionFormatWithMulti\"\n },\n \"default\": {\n \"$ref\": \"#/definitions/default\"\n },\n \"maximum\": {\n \"$ref\": \"#/definitions/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"#/definitions/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"#/definitions/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"#/definitions/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"#/definitions/maxLength\"\n },\n \"minLength\": {\n \"$ref\": \"#/definitions/minLength\"\n },\n \"pattern\": {\n \"$ref\": \"#/definitions/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"#/definitions/maxItems\"\n },\n \"minItems\": {\n \"$ref\": \"#/definitions/minItems\"\n },\n \"uniqueItems\": {\n \"$ref\": \"#/definitions/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"#/definitions/enum\"\n },\n \"multipleOf\": {\n \"$ref\": \"#/definitions/multipleOf\"\n }\n }\n },\n \"formDataParameterSubSchema\": {\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"required\": {\n \"type\": \"boolean\",\n \"description\": \"Determines whether or not this parameter is required or optional.\",\n \"default\": false\n },\n \"in\": {\n \"type\": \"string\",\n \"description\": \"Determines the location of the parameter.\",\n \"enum\": [\n \"formData\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the parameter.\"\n },\n \"allowEmptyValue\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"allows sending a parameter by name only or with an empty value.\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"integer\",\n \"array\",\n \"file\"\n ]\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"items\": {\n \"$ref\": \"#/definitions/primitivesItems\"\n },\n \"collectionFormat\": {\n \"$ref\": \"#/definitions/collectionFormatWithMulti\"\n },\n \"default\": {\n \"$ref\": \"#/definitions/default\"\n },\n \"maximum\": {\n \"$ref\": \"#/definitions/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"#/definitions/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"#/definitions/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"#/definitions/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"#/definitions/maxLength\"\n },\n \"minLength\": {\n \"$ref\": \"#/definitions/minLength\"\n },\n \"pattern\": {\n \"$ref\": \"#/definitions/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"#/definitions/maxItems\"\n },\n \"minItems\": {\n \"$ref\": \"#/definitions/minItems\"\n },\n \"uniqueItems\": {\n \"$ref\": \"#/definitions/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"#/definitions/enum\"\n },\n \"multipleOf\": {\n \"$ref\": \"#/definitions/multipleOf\"\n }\n }\n },\n \"pathParameterSubSchema\": {\n \"additionalProperties\": false,\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"required\": [\n \"required\"\n ],\n \"properties\": {\n \"required\": {\n \"type\": \"boolean\",\n \"enum\": [\n true\n ],\n \"description\": \"Determines whether or not this parameter is required or optional.\"\n },\n \"in\": {\n \"type\": \"string\",\n \"description\": \"Determines the location of the parameter.\",\n \"enum\": [\n \"path\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the parameter.\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"integer\",\n \"array\"\n ]\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"items\": {\n \"$ref\": \"#/definitions/primitivesItems\"\n },\n \"collectionFormat\": {\n \"$ref\": \"#/definitions/collectionFormat\"\n },\n \"default\": {\n \"$ref\": \"#/definitions/default\"\n },\n \"maximum\": {\n \"$ref\": \"#/definitions/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"#/definitions/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"#/definitions/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"#/definitions/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"#/definitions/maxLength\"\n },\n \"minLength\": {\n \"$ref\": \"#/definitions/minLength\"\n },\n \"pattern\": {\n \"$ref\": \"#/definitions/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"#/definitions/maxItems\"\n },\n \"minItems\": {\n \"$ref\": \"#/definitions/minItems\"\n },\n \"uniqueItems\": {\n \"$ref\": \"#/definitions/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"#/definitions/enum\"\n },\n \"multipleOf\": {\n \"$ref\": \"#/definitions/multipleOf\"\n }\n }\n },\n \"nonBodyParameter\": {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"in\",\n \"type\"\n ],\n \"oneOf\": [\n {\n \"$ref\": \"#/definitions/headerParameterSubSchema\"\n },\n {\n \"$ref\": \"#/definitions/formDataParameterSubSchema\"\n },\n {\n \"$ref\": \"#/definitions/queryParameterSubSchema\"\n },\n {\n \"$ref\": \"#/definitions/pathParameterSubSchema\"\n }\n ]\n },\n \"parameter\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/definitions/bodyParameter\"\n },\n {\n \"$ref\": \"#/definitions/nonBodyParameter\"\n }\n ]\n },\n \"schema\": {\n \"type\": \"object\",\n \"description\": \"A deterministic version of a JSON Schema object.\",\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"properties\": {\n \"$ref\": {\n \"type\": \"string\"\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/title\"\n },\n \"description\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/description\"\n },\n \"default\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/default\"\n },\n \"multipleOf\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/multipleOf\"\n },\n \"maximum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"\n },\n \"minLength\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"\n },\n \"pattern\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"\n },\n \"minItems\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"\n },\n \"uniqueItems\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"\n },\n \"maxProperties\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"\n },\n \"minProperties\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"\n },\n \"required\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/stringArray\"\n },\n \"enum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/enum\"\n },\n \"additionalProperties\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/schema\"\n },\n {\n \"type\": \"boolean\"\n }\n ],\n \"default\": {}\n },\n \"type\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/type\"\n },\n \"items\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/schema\"\n },\n {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/definitions/schema\"\n }\n }\n ],\n \"default\": {}\n },\n \"allOf\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/definitions/schema\"\n }\n },\n \"properties\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/schema\"\n },\n \"default\": {}\n },\n \"discriminator\": {\n \"type\": \"string\"\n },\n \"readOnly\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"xml\": {\n \"$ref\": \"#/definitions/xml\"\n },\n \"externalDocs\": {\n \"$ref\": \"#/definitions/externalDocs\"\n },\n \"example\": {}\n },\n \"additionalProperties\": false\n },\n \"fileSchema\": {\n \"type\": \"object\",\n \"description\": \"A deterministic version of a JSON Schema object.\",\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n },\n \"required\": [\n \"type\"\n ],\n \"properties\": {\n \"format\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/title\"\n },\n \"description\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/description\"\n },\n \"default\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/default\"\n },\n \"required\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/stringArray\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"file\"\n ]\n },\n \"readOnly\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"externalDocs\": {\n \"$ref\": \"#/definitions/externalDocs\"\n },\n \"example\": {}\n },\n \"additionalProperties\": false\n },\n \"primitivesItems\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"string\",\n \"number\",\n \"integer\",\n \"boolean\",\n \"array\"\n ]\n },\n \"format\": {\n \"type\": \"string\"\n },\n \"items\": {\n \"$ref\": \"#/definitions/primitivesItems\"\n },\n \"collectionFormat\": {\n \"$ref\": \"#/definitions/collectionFormat\"\n },\n \"default\": {\n \"$ref\": \"#/definitions/default\"\n },\n \"maximum\": {\n \"$ref\": \"#/definitions/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"#/definitions/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"#/definitions/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"#/definitions/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"#/definitions/maxLength\"\n },\n \"minLength\": {\n \"$ref\": \"#/definitions/minLength\"\n },\n \"pattern\": {\n \"$ref\": \"#/definitions/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"#/definitions/maxItems\"\n },\n \"minItems\": {\n \"$ref\": \"#/definitions/minItems\"\n },\n \"uniqueItems\": {\n \"$ref\": \"#/definitions/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"#/definitions/enum\"\n },\n \"multipleOf\": {\n \"$ref\": \"#/definitions/multipleOf\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"security\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/securityRequirement\"\n },\n \"uniqueItems\": true\n },\n \"securityRequirement\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"uniqueItems\": true\n }\n },\n \"xml\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"namespace\": {\n \"type\": \"string\"\n },\n \"prefix\": {\n \"type\": \"string\"\n },\n \"attribute\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"wrapped\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"tag\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"name\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"externalDocs\": {\n \"$ref\": \"#/definitions/externalDocs\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"securityDefinitions\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/definitions/basicAuthenticationSecurity\"\n },\n {\n \"$ref\": \"#/definitions/apiKeySecurity\"\n },\n {\n \"$ref\": \"#/definitions/oauth2ImplicitSecurity\"\n },\n {\n \"$ref\": \"#/definitions/oauth2PasswordSecurity\"\n },\n {\n \"$ref\": \"#/definitions/oauth2ApplicationSecurity\"\n },\n {\n \"$ref\": \"#/definitions/oauth2AccessCodeSecurity\"\n }\n ]\n }\n },\n \"basicAuthenticationSecurity\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"basic\"\n ]\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"apiKeySecurity\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\",\n \"name\",\n \"in\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"apiKey\"\n ]\n },\n \"name\": {\n \"type\": \"string\"\n },\n \"in\": {\n \"type\": \"string\",\n \"enum\": [\n \"header\",\n \"query\"\n ]\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"oauth2ImplicitSecurity\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\",\n \"flow\",\n \"authorizationUrl\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"oauth2\"\n ]\n },\n \"flow\": {\n \"type\": \"string\",\n \"enum\": [\n \"implicit\"\n ]\n },\n \"scopes\": {\n \"$ref\": \"#/definitions/oauth2Scopes\"\n },\n \"authorizationUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"oauth2PasswordSecurity\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\",\n \"flow\",\n \"tokenUrl\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"oauth2\"\n ]\n },\n \"flow\": {\n \"type\": \"string\",\n \"enum\": [\n \"password\"\n ]\n },\n \"scopes\": {\n \"$ref\": \"#/definitions/oauth2Scopes\"\n },\n \"tokenUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"oauth2ApplicationSecurity\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\",\n \"flow\",\n \"tokenUrl\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"oauth2\"\n ]\n },\n \"flow\": {\n \"type\": \"string\",\n \"enum\": [\n \"application\"\n ]\n },\n \"scopes\": {\n \"$ref\": \"#/definitions/oauth2Scopes\"\n },\n \"tokenUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"oauth2AccessCodeSecurity\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"type\",\n \"flow\",\n \"authorizationUrl\",\n \"tokenUrl\"\n ],\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"oauth2\"\n ]\n },\n \"flow\": {\n \"type\": \"string\",\n \"enum\": [\n \"accessCode\"\n ]\n },\n \"scopes\": {\n \"$ref\": \"#/definitions/oauth2Scopes\"\n },\n \"authorizationUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"tokenUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"patternProperties\": {\n \"^x-\": {\n \"$ref\": \"#/definitions/vendorExtension\"\n }\n }\n },\n \"oauth2Scopes\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n },\n \"mediaTypeList\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/mimeType\"\n },\n \"uniqueItems\": true\n },\n \"parametersList\": {\n \"type\": \"array\",\n \"description\": \"The parameters needed to send a valid API call.\",\n \"additionalItems\": false,\n \"items\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/definitions/parameter\"\n },\n {\n \"$ref\": \"#/definitions/jsonReference\"\n }\n ]\n },\n \"uniqueItems\": true\n },\n \"schemesList\": {\n \"type\": \"array\",\n \"description\": \"The transfer protocol of the API.\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\n \"http\",\n \"https\",\n \"ws\",\n \"wss\"\n ]\n },\n \"uniqueItems\": true\n },\n \"collectionFormat\": {\n \"type\": \"string\",\n \"enum\": [\n \"csv\",\n \"ssv\",\n \"tsv\",\n \"pipes\"\n ],\n \"default\": \"csv\"\n },\n \"collectionFormatWithMulti\": {\n \"type\": \"string\",\n \"enum\": [\n \"csv\",\n \"ssv\",\n \"tsv\",\n \"pipes\",\n \"multi\"\n ],\n \"default\": \"csv\"\n },\n \"title\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/title\"\n },\n \"description\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/description\"\n },\n \"default\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/default\"\n },\n \"multipleOf\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/multipleOf\"\n },\n \"maximum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/maximum\"\n },\n \"exclusiveMaximum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"\n },\n \"minimum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/minimum\"\n },\n \"exclusiveMinimum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"\n },\n \"maxLength\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"\n },\n \"minLength\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"\n },\n \"pattern\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/pattern\"\n },\n \"maxItems\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"\n },\n \"minItems\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"\n },\n \"uniqueItems\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"\n },\n \"enum\": {\n \"$ref\": \"http://json-schema.org/draft-04/schema#/properties/enum\"\n },\n \"jsonReference\": {\n \"type\": \"object\",\n \"required\": [\n \"$ref\"\n ],\n \"additionalProperties\": false,\n \"properties\": {\n \"$ref\": {\n \"type\": \"string\"\n }\n }\n }\n }\n}", - "var Buffer = require('buffer').Buffer\n\nmodule.exports = function (buf) {\n\t// If the buffer is backed by a Uint8Array, a faster version will work\n\tif (buf instanceof Uint8Array) {\n\t\t// If the buffer isn't a subarray, return the underlying ArrayBuffer\n\t\tif (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {\n\t\t\treturn buf.buffer\n\t\t} else if (typeof buf.buffer.slice === 'function') {\n\t\t\t// Otherwise we need to get a proper copy\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)\n\t\t}\n\t}\n\n\tif (Buffer.isBuffer(buf)) {\n\t\t// This is the slow version that will work with any Buffer\n\t\t// implementation (even in old browsers)\n\t\tvar arrayCopy = new Uint8Array(buf.length)\n\t\tvar len = buf.length\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tarrayCopy[i] = buf[i]\n\t\t}\n\t\treturn arrayCopy.buffer\n\t} else {\n\t\tthrow new Error('Argument must be a Buffer')\n\t}\n}\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n", "'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n", "\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n", "module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _toDate = require('./lib/toDate');\n\nvar _toDate2 = _interopRequireDefault(_toDate);\n\nvar _toFloat = require('./lib/toFloat');\n\nvar _toFloat2 = _interopRequireDefault(_toFloat);\n\nvar _toInt = require('./lib/toInt');\n\nvar _toInt2 = _interopRequireDefault(_toInt);\n\nvar _toBoolean = require('./lib/toBoolean');\n\nvar _toBoolean2 = _interopRequireDefault(_toBoolean);\n\nvar _equals = require('./lib/equals');\n\nvar _equals2 = _interopRequireDefault(_equals);\n\nvar _contains = require('./lib/contains');\n\nvar _contains2 = _interopRequireDefault(_contains);\n\nvar _matches = require('./lib/matches');\n\nvar _matches2 = _interopRequireDefault(_matches);\n\nvar _isEmail = require('./lib/isEmail');\n\nvar _isEmail2 = _interopRequireDefault(_isEmail);\n\nvar _isURL = require('./lib/isURL');\n\nvar _isURL2 = _interopRequireDefault(_isURL);\n\nvar _isMACAddress = require('./lib/isMACAddress');\n\nvar _isMACAddress2 = _interopRequireDefault(_isMACAddress);\n\nvar _isIP = require('./lib/isIP');\n\nvar _isIP2 = _interopRequireDefault(_isIP);\n\nvar _isFQDN = require('./lib/isFQDN');\n\nvar _isFQDN2 = _interopRequireDefault(_isFQDN);\n\nvar _isBoolean = require('./lib/isBoolean');\n\nvar _isBoolean2 = _interopRequireDefault(_isBoolean);\n\nvar _isAlpha = require('./lib/isAlpha');\n\nvar _isAlpha2 = _interopRequireDefault(_isAlpha);\n\nvar _isAlphanumeric = require('./lib/isAlphanumeric');\n\nvar _isAlphanumeric2 = _interopRequireDefault(_isAlphanumeric);\n\nvar _isNumeric = require('./lib/isNumeric');\n\nvar _isNumeric2 = _interopRequireDefault(_isNumeric);\n\nvar _isLowercase = require('./lib/isLowercase');\n\nvar _isLowercase2 = _interopRequireDefault(_isLowercase);\n\nvar _isUppercase = require('./lib/isUppercase');\n\nvar _isUppercase2 = _interopRequireDefault(_isUppercase);\n\nvar _isAscii = require('./lib/isAscii');\n\nvar _isAscii2 = _interopRequireDefault(_isAscii);\n\nvar _isFullWidth = require('./lib/isFullWidth');\n\nvar _isFullWidth2 = _interopRequireDefault(_isFullWidth);\n\nvar _isHalfWidth = require('./lib/isHalfWidth');\n\nvar _isHalfWidth2 = _interopRequireDefault(_isHalfWidth);\n\nvar _isVariableWidth = require('./lib/isVariableWidth');\n\nvar _isVariableWidth2 = _interopRequireDefault(_isVariableWidth);\n\nvar _isMultibyte = require('./lib/isMultibyte');\n\nvar _isMultibyte2 = _interopRequireDefault(_isMultibyte);\n\nvar _isSurrogatePair = require('./lib/isSurrogatePair');\n\nvar _isSurrogatePair2 = _interopRequireDefault(_isSurrogatePair);\n\nvar _isInt = require('./lib/isInt');\n\nvar _isInt2 = _interopRequireDefault(_isInt);\n\nvar _isFloat = require('./lib/isFloat');\n\nvar _isFloat2 = _interopRequireDefault(_isFloat);\n\nvar _isDecimal = require('./lib/isDecimal');\n\nvar _isDecimal2 = _interopRequireDefault(_isDecimal);\n\nvar _isHexadecimal = require('./lib/isHexadecimal');\n\nvar _isHexadecimal2 = _interopRequireDefault(_isHexadecimal);\n\nvar _isDivisibleBy = require('./lib/isDivisibleBy');\n\nvar _isDivisibleBy2 = _interopRequireDefault(_isDivisibleBy);\n\nvar _isHexColor = require('./lib/isHexColor');\n\nvar _isHexColor2 = _interopRequireDefault(_isHexColor);\n\nvar _isJSON = require('./lib/isJSON');\n\nvar _isJSON2 = _interopRequireDefault(_isJSON);\n\nvar _isNull = require('./lib/isNull');\n\nvar _isNull2 = _interopRequireDefault(_isNull);\n\nvar _isLength = require('./lib/isLength');\n\nvar _isLength2 = _interopRequireDefault(_isLength);\n\nvar _isByteLength = require('./lib/isByteLength');\n\nvar _isByteLength2 = _interopRequireDefault(_isByteLength);\n\nvar _isUUID = require('./lib/isUUID');\n\nvar _isUUID2 = _interopRequireDefault(_isUUID);\n\nvar _isMongoId = require('./lib/isMongoId');\n\nvar _isMongoId2 = _interopRequireDefault(_isMongoId);\n\nvar _isDate = require('./lib/isDate');\n\nvar _isDate2 = _interopRequireDefault(_isDate);\n\nvar _isAfter = require('./lib/isAfter');\n\nvar _isAfter2 = _interopRequireDefault(_isAfter);\n\nvar _isBefore = require('./lib/isBefore');\n\nvar _isBefore2 = _interopRequireDefault(_isBefore);\n\nvar _isIn = require('./lib/isIn');\n\nvar _isIn2 = _interopRequireDefault(_isIn);\n\nvar _isCreditCard = require('./lib/isCreditCard');\n\nvar _isCreditCard2 = _interopRequireDefault(_isCreditCard);\n\nvar _isISIN = require('./lib/isISIN');\n\nvar _isISIN2 = _interopRequireDefault(_isISIN);\n\nvar _isISBN = require('./lib/isISBN');\n\nvar _isISBN2 = _interopRequireDefault(_isISBN);\n\nvar _isMobilePhone = require('./lib/isMobilePhone');\n\nvar _isMobilePhone2 = _interopRequireDefault(_isMobilePhone);\n\nvar _isCurrency = require('./lib/isCurrency');\n\nvar _isCurrency2 = _interopRequireDefault(_isCurrency);\n\nvar _isISO = require('./lib/isISO8601');\n\nvar _isISO2 = _interopRequireDefault(_isISO);\n\nvar _isBase = require('./lib/isBase64');\n\nvar _isBase2 = _interopRequireDefault(_isBase);\n\nvar _isDataURI = require('./lib/isDataURI');\n\nvar _isDataURI2 = _interopRequireDefault(_isDataURI);\n\nvar _ltrim = require('./lib/ltrim');\n\nvar _ltrim2 = _interopRequireDefault(_ltrim);\n\nvar _rtrim = require('./lib/rtrim');\n\nvar _rtrim2 = _interopRequireDefault(_rtrim);\n\nvar _trim = require('./lib/trim');\n\nvar _trim2 = _interopRequireDefault(_trim);\n\nvar _escape = require('./lib/escape');\n\nvar _escape2 = _interopRequireDefault(_escape);\n\nvar _unescape = require('./lib/unescape');\n\nvar _unescape2 = _interopRequireDefault(_unescape);\n\nvar _stripLow = require('./lib/stripLow');\n\nvar _stripLow2 = _interopRequireDefault(_stripLow);\n\nvar _whitelist = require('./lib/whitelist');\n\nvar _whitelist2 = _interopRequireDefault(_whitelist);\n\nvar _blacklist = require('./lib/blacklist');\n\nvar _blacklist2 = _interopRequireDefault(_blacklist);\n\nvar _isWhitelisted = require('./lib/isWhitelisted');\n\nvar _isWhitelisted2 = _interopRequireDefault(_isWhitelisted);\n\nvar _normalizeEmail = require('./lib/normalizeEmail');\n\nvar _normalizeEmail2 = _interopRequireDefault(_normalizeEmail);\n\nvar _toString = require('./lib/util/toString');\n\nvar _toString2 = _interopRequireDefault(_toString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar version = '5.2.0';\n\nvar validator = {\n version: version,\n toDate: _toDate2.default,\n toFloat: _toFloat2.default, toInt: _toInt2.default,\n toBoolean: _toBoolean2.default,\n equals: _equals2.default, contains: _contains2.default, matches: _matches2.default,\n isEmail: _isEmail2.default, isURL: _isURL2.default, isMACAddress: _isMACAddress2.default, isIP: _isIP2.default, isFQDN: _isFQDN2.default,\n isBoolean: _isBoolean2.default,\n isAlpha: _isAlpha2.default, isAlphanumeric: _isAlphanumeric2.default, isNumeric: _isNumeric2.default, isLowercase: _isLowercase2.default, isUppercase: _isUppercase2.default,\n isAscii: _isAscii2.default, isFullWidth: _isFullWidth2.default, isHalfWidth: _isHalfWidth2.default, isVariableWidth: _isVariableWidth2.default,\n isMultibyte: _isMultibyte2.default, isSurrogatePair: _isSurrogatePair2.default,\n isInt: _isInt2.default, isFloat: _isFloat2.default, isDecimal: _isDecimal2.default, isHexadecimal: _isHexadecimal2.default, isDivisibleBy: _isDivisibleBy2.default,\n isHexColor: _isHexColor2.default,\n isJSON: _isJSON2.default,\n isNull: _isNull2.default,\n isLength: _isLength2.default, isByteLength: _isByteLength2.default,\n isUUID: _isUUID2.default, isMongoId: _isMongoId2.default,\n isDate: _isDate2.default, isAfter: _isAfter2.default, isBefore: _isBefore2.default,\n isIn: _isIn2.default,\n isCreditCard: _isCreditCard2.default,\n isISIN: _isISIN2.default, isISBN: _isISBN2.default,\n isMobilePhone: _isMobilePhone2.default,\n isCurrency: _isCurrency2.default,\n isISO8601: _isISO2.default,\n isBase64: _isBase2.default, isDataURI: _isDataURI2.default,\n ltrim: _ltrim2.default, rtrim: _rtrim2.default, trim: _trim2.default,\n escape: _escape2.default, unescape: _unescape2.default, stripLow: _stripLow2.default,\n whitelist: _whitelist2.default, blacklist: _blacklist2.default,\n isWhitelisted: _isWhitelisted2.default,\n normalizeEmail: _normalizeEmail2.default,\n toString: _toString2.default\n};\n\nexports.default = validator;\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar alpha = exports.alpha = {\n 'en-US': /^[A-Z]+$/i,\n 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,\n 'de-DE': /^[A-ZÄÖÜß]+$/i,\n 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,\n 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,\n 'nl-NL': /^[A-ZÉËÏÓÖÜ]+$/i,\n 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,\n 'pt-PT': /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,\n 'ru-RU': /^[А-ЯЁа-яё]+$/i,\n 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,\n ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/\n};\n\nvar alphanumeric = exports.alphanumeric = {\n 'en-US': /^[0-9A-Z]+$/i,\n 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,\n 'de-DE': /^[0-9A-ZÄÖÜß]+$/i,\n 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,\n 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,\n 'nl-NL': /^[0-9A-ZÉËÏÓÖÜ]+$/i,\n 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,\n 'pt-PT': /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,\n 'ru-RU': /^[0-9А-ЯЁа-яё]+$/i,\n 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,\n ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/\n};\n\nvar englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];\n\nfor (var locale, i = 0; i < englishLocales.length; i++) {\n locale = 'en-' + englishLocales[i];\n alpha[locale] = alpha['en-US'];\n alphanumeric[locale] = alphanumeric['en-US'];\n}\n\n// Source: http://www.localeplanet.com/java/\nvar arabicLocales = exports.arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];\n\nfor (var _locale, _i = 0; _i < arabicLocales.length; _i++) {\n _locale = 'ar-' + arabicLocales[_i];\n alpha[_locale] = alpha.ar;\n alphanumeric[_locale] = alphanumeric.ar;\n}", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = blacklist;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction blacklist(str, chars) {\n (0, _assertString2.default)(str);\n return str.replace(new RegExp('[' + chars + ']+', 'g'), '');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = contains;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _toString = require('./util/toString');\n\nvar _toString2 = _interopRequireDefault(_toString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction contains(str, elem) {\n (0, _assertString2.default)(str);\n return str.indexOf((0, _toString2.default)(elem)) >= 0;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = equals;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction equals(str, comparison) {\n (0, _assertString2.default)(str);\n return str === comparison;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = escape;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction escape(str) {\n (0, _assertString2.default)(str);\n return str.replace(/&/g, '&').replace(/\"/g, '"').replace(/'/g, ''').replace(//g, '>').replace(/\\//g, '/').replace(/\\`/g, '`');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isAfter;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _toDate = require('./toDate');\n\nvar _toDate2 = _interopRequireDefault(_toDate);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isAfter(str) {\n var date = arguments.length <= 1 || arguments[1] === undefined ? String(new Date()) : arguments[1];\n\n (0, _assertString2.default)(str);\n var comparison = (0, _toDate2.default)(date);\n var original = (0, _toDate2.default)(str);\n return !!(original && comparison && original > comparison);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isAlpha;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _alpha = require('./alpha');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isAlpha(str) {\n var locale = arguments.length <= 1 || arguments[1] === undefined ? 'en-US' : arguments[1];\n\n (0, _assertString2.default)(str);\n if (locale in _alpha.alpha) {\n return _alpha.alpha[locale].test(str);\n }\n throw new Error('Invalid locale \\'' + locale + '\\'');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isAlphanumeric;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _alpha = require('./alpha');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isAlphanumeric(str) {\n var locale = arguments.length <= 1 || arguments[1] === undefined ? 'en-US' : arguments[1];\n\n (0, _assertString2.default)(str);\n if (locale in _alpha.alphanumeric) {\n return _alpha.alphanumeric[locale].test(str);\n }\n throw new Error('Invalid locale \\'' + locale + '\\'');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isAscii;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar ascii = /^[\\x00-\\x7F]+$/;\n\nfunction isAscii(str) {\n (0, _assertString2.default)(str);\n return ascii.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isBase64;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar notBase64 = /[^A-Z0-9+\\/=]/i;\n\nfunction isBase64(str) {\n (0, _assertString2.default)(str);\n var len = str.length;\n if (!len || len % 4 !== 0 || notBase64.test(str)) {\n return false;\n }\n var firstPaddingChar = str.indexOf('=');\n return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '=';\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isBefore;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _toDate = require('./toDate');\n\nvar _toDate2 = _interopRequireDefault(_toDate);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isBefore(str) {\n var date = arguments.length <= 1 || arguments[1] === undefined ? String(new Date()) : arguments[1];\n\n (0, _assertString2.default)(str);\n var comparison = (0, _toDate2.default)(date);\n var original = (0, _toDate2.default)(str);\n return !!(original && comparison && original < comparison);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isBoolean;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isBoolean(str) {\n (0, _assertString2.default)(str);\n return ['true', 'false', '1', '0'].indexOf(str) >= 0;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = isByteLength;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-disable prefer-rest-params */\nfunction isByteLength(str, options) {\n (0, _assertString2.default)(str);\n var min = void 0;\n var max = void 0;\n if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {\n min = options.min || 0;\n max = options.max;\n } else {\n // backwards compatibility: isByteLength(str, min [, max])\n min = arguments[1];\n max = arguments[2];\n }\n var len = encodeURI(str).split(/%..|./).length - 1;\n return len >= min && (typeof max === 'undefined' || len <= max);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isCreditCard;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-disable max-len */\nvar creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$/;\n/* eslint-enable max-len */\n\nfunction isCreditCard(str) {\n (0, _assertString2.default)(str);\n var sanitized = str.replace(/[^0-9]+/g, '');\n if (!creditCard.test(sanitized)) {\n return false;\n }\n var sum = 0;\n var digit = void 0;\n var tmpNum = void 0;\n var shouldDouble = void 0;\n for (var i = sanitized.length - 1; i >= 0; i--) {\n digit = sanitized.substring(i, i + 1);\n tmpNum = parseInt(digit, 10);\n if (shouldDouble) {\n tmpNum *= 2;\n if (tmpNum >= 10) {\n sum += tmpNum % 10 + 1;\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n shouldDouble = !shouldDouble;\n }\n return !!(sum % 10 === 0 ? sanitized : false);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isCurrency;\n\nvar _merge = require('./util/merge');\n\nvar _merge2 = _interopRequireDefault(_merge);\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction currencyRegex(options) {\n var symbol = '(\\\\' + options.symbol.replace(/\\./g, '\\\\.') + ')' + (options.require_symbol ? '' : '?'),\n negative = '-?',\n whole_dollar_amount_without_sep = '[1-9]\\\\d*',\n whole_dollar_amount_with_sep = '[1-9]\\\\d{0,2}(\\\\' + options.thousands_separator + '\\\\d{3})*',\n valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep],\n whole_dollar_amount = '(' + valid_whole_dollar_amounts.join('|') + ')?',\n decimal_amount = '(\\\\' + options.decimal_separator + '\\\\d{2})?';\n var pattern = whole_dollar_amount + decimal_amount;\n\n // default is negative sign before symbol, but there are two other options (besides parens)\n if (options.allow_negatives && !options.parens_for_negatives) {\n if (options.negative_sign_after_digits) {\n pattern += negative;\n } else if (options.negative_sign_before_digits) {\n pattern = negative + pattern;\n }\n }\n\n // South African Rand, for example, uses R 123 (space) and R-123 (no space)\n if (options.allow_negative_sign_placeholder) {\n pattern = '( (?!\\\\-))?' + pattern;\n } else if (options.allow_space_after_symbol) {\n pattern = ' ?' + pattern;\n } else if (options.allow_space_after_digits) {\n pattern += '( (?!$))?';\n }\n\n if (options.symbol_after_digits) {\n pattern += symbol;\n } else {\n pattern = symbol + pattern;\n }\n\n if (options.allow_negatives) {\n if (options.parens_for_negatives) {\n pattern = '(\\\\(' + pattern + '\\\\)|' + pattern + ')';\n } else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) {\n pattern = negative + pattern;\n }\n }\n\n /* eslint-disable prefer-template */\n return new RegExp('^' +\n // ensure there's a dollar and/or decimal amount, and that\n // it doesn't start with a space or a negative sign followed by a space\n '(?!-? )(?=.*\\\\d)' + pattern + '$');\n /* eslint-enable prefer-template */\n}\n\nvar default_currency_options = {\n symbol: '$',\n require_symbol: false,\n allow_space_after_symbol: false,\n symbol_after_digits: false,\n allow_negatives: true,\n parens_for_negatives: false,\n negative_sign_before_digits: false,\n negative_sign_after_digits: false,\n allow_negative_sign_placeholder: false,\n thousands_separator: ',',\n decimal_separator: '.',\n allow_space_after_digits: false\n};\n\nfunction isCurrency(str, options) {\n (0, _assertString2.default)(str);\n options = (0, _merge2.default)(options, default_currency_options);\n return currencyRegex(options).test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isDataURI;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar dataURI = /^\\s*data:([a-z]+\\/[a-z0-9\\-\\+]+(;[a-z\\-]+\\=[a-z0-9\\-]+)?)?(;base64)?,[a-z0-9\\!\\$\\&\\'\\,\\(\\)\\*\\+\\,\\;\\=\\-\\.\\_\\~\\:\\@\\/\\?\\%\\s]*\\s*$/i; // eslint-disable-line max-len\n\nfunction isDataURI(str) {\n (0, _assertString2.default)(str);\n return dataURI.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isDate;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _isISO = require('./isISO8601');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getTimezoneOffset(str) {\n var iso8601Parts = str.match(_isISO.iso8601);\n var timezone = void 0,\n sign = void 0,\n hours = void 0,\n minutes = void 0;\n if (!iso8601Parts) {\n str = str.toLowerCase();\n timezone = str.match(/(?:\\s|gmt\\s*)(-|\\+)(\\d{1,4})(\\s|$)/);\n if (!timezone) {\n return str.indexOf('gmt') !== -1 ? 0 : null;\n }\n sign = timezone[1];\n var offset = timezone[2];\n if (offset.length === 3) {\n offset = '0' + offset;\n }\n if (offset.length <= 2) {\n hours = 0;\n minutes = parseInt(offset, 10);\n } else {\n hours = parseInt(offset.slice(0, 2), 10);\n minutes = parseInt(offset.slice(2, 4), 10);\n }\n } else {\n timezone = iso8601Parts[21];\n if (!timezone) {\n // if no hour/minute was provided, the date is GMT\n return !iso8601Parts[12] ? 0 : null;\n }\n if (timezone === 'z' || timezone === 'Z') {\n return 0;\n }\n sign = iso8601Parts[22];\n if (timezone.indexOf(':') !== -1) {\n hours = parseInt(iso8601Parts[23], 10);\n minutes = parseInt(iso8601Parts[24], 10);\n } else {\n hours = 0;\n minutes = parseInt(iso8601Parts[23], 10);\n }\n }\n return (hours * 60 + minutes) * (sign === '-' ? 1 : -1);\n}\n\nfunction isDate(str) {\n (0, _assertString2.default)(str);\n var normalizedDate = new Date(Date.parse(str));\n if (isNaN(normalizedDate)) {\n return false;\n }\n\n // normalizedDate is in the user's timezone. Apply the input\n // timezone offset to the date so that the year and day match\n // the input\n var timezoneOffset = getTimezoneOffset(str);\n if (timezoneOffset !== null) {\n var timezoneDifference = normalizedDate.getTimezoneOffset() - timezoneOffset;\n normalizedDate = new Date(normalizedDate.getTime() + 60000 * timezoneDifference);\n }\n\n var day = String(normalizedDate.getDate());\n var dayOrYear = void 0,\n dayOrYearMatches = void 0,\n year = void 0;\n // check for valid double digits that could be late days\n // check for all matches since a string like '12/23' is a valid date\n // ignore everything with nearby colons\n dayOrYearMatches = str.match(/(^|[^:\\d])[23]\\d([^:\\d]|$)/g);\n if (!dayOrYearMatches) {\n return true;\n }\n dayOrYear = dayOrYearMatches.map(function (digitString) {\n return digitString.match(/\\d+/g)[0];\n }).join('/');\n\n year = String(normalizedDate.getFullYear()).slice(-2);\n if (dayOrYear === day || dayOrYear === year) {\n return true;\n } else if (dayOrYear === '' + day / year || dayOrYear === '' + year / day) {\n return true;\n }\n return false;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isDecimal;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar decimal = /^[-+]?([0-9]+|\\.[0-9]+|[0-9]+\\.[0-9]+)$/;\n\nfunction isDecimal(str) {\n (0, _assertString2.default)(str);\n return str !== '' && decimal.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isDivisibleBy;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _toFloat = require('./toFloat');\n\nvar _toFloat2 = _interopRequireDefault(_toFloat);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isDivisibleBy(str, num) {\n (0, _assertString2.default)(str);\n return (0, _toFloat2.default)(str) % parseInt(num, 10) === 0;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isEmail;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _merge = require('./util/merge');\n\nvar _merge2 = _interopRequireDefault(_merge);\n\nvar _isByteLength = require('./isByteLength');\n\nvar _isByteLength2 = _interopRequireDefault(_isByteLength);\n\nvar _isFQDN = require('./isFQDN');\n\nvar _isFQDN2 = _interopRequireDefault(_isFQDN);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_email_options = {\n allow_display_name: false,\n allow_utf8_local_part: true,\n require_tld: true\n};\n\n/* eslint-disable max-len */\nvar displayName = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF\\s]*<(.+)>$/i;\nvar emailUserPart = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]+$/i;\nvar quotedEmailUser = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]))*$/i;\nvar emailUserUtf8Part = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+$/i;\nvar quotedEmailUserUtf8 = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*$/i;\n/* eslint-enable max-len */\n\nfunction isEmail(str, options) {\n (0, _assertString2.default)(str);\n options = (0, _merge2.default)(options, default_email_options);\n\n if (options.allow_display_name) {\n var display_email = str.match(displayName);\n if (display_email) {\n str = display_email[1];\n }\n }\n\n var parts = str.split('@');\n var domain = parts.pop();\n var user = parts.join('@');\n\n var lower_domain = domain.toLowerCase();\n if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {\n user = user.replace(/\\./g, '').toLowerCase();\n }\n\n if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max: 256 })) {\n return false;\n }\n\n if (!(0, _isFQDN2.default)(domain, { require_tld: options.require_tld })) {\n return false;\n }\n\n if (user[0] === '\"') {\n user = user.slice(1, user.length - 1);\n return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);\n }\n\n var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;\n\n var user_parts = user.split('.');\n for (var i = 0; i < user_parts.length; i++) {\n if (!pattern.test(user_parts[i])) {\n return false;\n }\n }\n\n return true;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isFDQN;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _merge = require('./util/merge');\n\nvar _merge2 = _interopRequireDefault(_merge);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_fqdn_options = {\n require_tld: true,\n allow_underscores: false,\n allow_trailing_dot: false\n};\n\nfunction isFDQN(str, options) {\n (0, _assertString2.default)(str);\n options = (0, _merge2.default)(options, default_fqdn_options);\n\n /* Remove the optional trailing dot before checking validity */\n if (options.allow_trailing_dot && str[str.length - 1] === '.') {\n str = str.substring(0, str.length - 1);\n }\n var parts = str.split('.');\n if (options.require_tld) {\n var tld = parts.pop();\n if (!parts.length || !/^([a-z\\u00a1-\\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {\n return false;\n }\n }\n for (var part, i = 0; i < parts.length; i++) {\n part = parts[i];\n if (options.allow_underscores) {\n part = part.replace(/_/g, '');\n }\n if (!/^[a-z\\u00a1-\\uffff0-9-]+$/i.test(part)) {\n return false;\n }\n if (/[\\uff01-\\uff5e]/.test(part)) {\n // disallow full-width chars\n return false;\n }\n if (part[0] === '-' || part[part.length - 1] === '-') {\n return false;\n }\n }\n return true;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isFloat;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar float = /^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$/;\n\nfunction isFloat(str, options) {\n (0, _assertString2.default)(str);\n options = options || {};\n if (str === '' || str === '.') {\n return false;\n }\n return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.fullWidth = undefined;\nexports.default = isFullWidth;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fullWidth = exports.fullWidth = /[^\\u0020-\\u007E\\uFF61-\\uFF9F\\uFFA0-\\uFFDC\\uFFE8-\\uFFEE0-9a-zA-Z]/;\n\nfunction isFullWidth(str) {\n (0, _assertString2.default)(str);\n return fullWidth.test(str);\n}", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.halfWidth = undefined;\nexports.default = isHalfWidth;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar halfWidth = exports.halfWidth = /[\\u0020-\\u007E\\uFF61-\\uFF9F\\uFFA0-\\uFFDC\\uFFE8-\\uFFEE0-9a-zA-Z]/;\n\nfunction isHalfWidth(str) {\n (0, _assertString2.default)(str);\n return halfWidth.test(str);\n}", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isHexColor;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;\n\nfunction isHexColor(str) {\n (0, _assertString2.default)(str);\n return hexcolor.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isHexadecimal;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar hexadecimal = /^[0-9A-F]+$/i;\n\nfunction isHexadecimal(str) {\n (0, _assertString2.default)(str);\n return hexadecimal.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isIP;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar ipv4Maybe = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/;\nvar ipv6Block = /^[0-9A-F]{1,4}$/i;\n\nfunction isIP(str) {\n var version = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n\n (0, _assertString2.default)(str);\n version = String(version);\n if (!version) {\n return isIP(str, 4) || isIP(str, 6);\n } else if (version === '4') {\n if (!ipv4Maybe.test(str)) {\n return false;\n }\n var parts = str.split('.').sort(function (a, b) {\n return a - b;\n });\n return parts[3] <= 255;\n } else if (version === '6') {\n var blocks = str.split(':');\n var foundOmissionBlock = false; // marker to indicate ::\n\n // At least some OS accept the last 32 bits of an IPv6 address\n // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says\n // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,\n // and '::a.b.c.d' is deprecated, but also valid.\n var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);\n var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;\n\n if (blocks.length > expectedNumberOfBlocks) {\n return false;\n }\n // initial or final ::\n if (str === '::') {\n return true;\n } else if (str.substr(0, 2) === '::') {\n blocks.shift();\n blocks.shift();\n foundOmissionBlock = true;\n } else if (str.substr(str.length - 2) === '::') {\n blocks.pop();\n blocks.pop();\n foundOmissionBlock = true;\n }\n\n for (var i = 0; i < blocks.length; ++i) {\n // test for a :: which can not be at the string start/end\n // since those cases have been handled above\n if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {\n if (foundOmissionBlock) {\n return false; // multiple :: in address\n }\n foundOmissionBlock = true;\n } else if (foundIPv4TransitionBlock && i === blocks.length - 1) {\n // it has been checked before that the last\n // block is a valid IPv4 address\n } else if (!ipv6Block.test(blocks[i])) {\n return false;\n }\n }\n if (foundOmissionBlock) {\n return blocks.length >= 1;\n }\n return blocks.length === expectedNumberOfBlocks;\n }\n return false;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isISBN;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/;\nvar isbn13Maybe = /^(?:[0-9]{13})$/;\nvar factor = [1, 3];\n\nfunction isISBN(str) {\n var version = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];\n\n (0, _assertString2.default)(str);\n version = String(version);\n if (!version) {\n return isISBN(str, 10) || isISBN(str, 13);\n }\n var sanitized = str.replace(/[\\s-]+/g, '');\n var checksum = 0;\n var i = void 0;\n if (version === '10') {\n if (!isbn10Maybe.test(sanitized)) {\n return false;\n }\n for (i = 0; i < 9; i++) {\n checksum += (i + 1) * sanitized.charAt(i);\n }\n if (sanitized.charAt(9) === 'X') {\n checksum += 10 * 10;\n } else {\n checksum += 10 * sanitized.charAt(9);\n }\n if (checksum % 11 === 0) {\n return !!sanitized;\n }\n } else if (version === '13') {\n if (!isbn13Maybe.test(sanitized)) {\n return false;\n }\n for (i = 0; i < 12; i++) {\n checksum += factor[i % 2] * sanitized.charAt(i);\n }\n if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) {\n return !!sanitized;\n }\n }\n return false;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isISIN;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;\n\nfunction isISIN(str) {\n (0, _assertString2.default)(str);\n if (!isin.test(str)) {\n return false;\n }\n\n var checksumStr = str.replace(/[A-Z]/g, function (character) {\n return parseInt(character, 36);\n });\n\n var sum = 0;\n var digit = void 0;\n var tmpNum = void 0;\n var shouldDouble = true;\n for (var i = checksumStr.length - 2; i >= 0; i--) {\n digit = checksumStr.substring(i, i + 1);\n tmpNum = parseInt(digit, 10);\n if (shouldDouble) {\n tmpNum *= 2;\n if (tmpNum >= 10) {\n sum += tmpNum + 1;\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n shouldDouble = !shouldDouble;\n }\n\n return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.iso8601 = undefined;\n\nexports.default = function (str) {\n (0, _assertString2.default)(str);\n return iso8601.test(str);\n};\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-disable max-len */\n// from http://goo.gl/0ejHHW\nvar iso8601 = exports.iso8601 = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n/* eslint-enable max-len */", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = isIn;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _toString = require('./util/toString');\n\nvar _toString2 = _interopRequireDefault(_toString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isIn(str, options) {\n (0, _assertString2.default)(str);\n var i = void 0;\n if (Object.prototype.toString.call(options) === '[object Array]') {\n var array = [];\n for (i in options) {\n if ({}.hasOwnProperty.call(options, i)) {\n array[i] = (0, _toString2.default)(options[i]);\n }\n }\n return array.indexOf(str) >= 0;\n } else if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {\n return options.hasOwnProperty(str);\n } else if (options && typeof options.indexOf === 'function') {\n return options.indexOf(str) >= 0;\n }\n return false;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isInt;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/;\n\nfunction isInt(str, options) {\n (0, _assertString2.default)(str);\n options = options || {};\n return int.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = isJSON;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isJSON(str) {\n (0, _assertString2.default)(str);\n try {\n var obj = JSON.parse(str);\n return !!obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';\n } catch (e) {/* ignore */}\n return false;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = isLength;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-disable prefer-rest-params */\nfunction isLength(str, options) {\n (0, _assertString2.default)(str);\n var min = void 0;\n var max = void 0;\n if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {\n min = options.min || 0;\n max = options.max;\n } else {\n // backwards compatibility: isLength(str, min [, max])\n min = arguments[1];\n max = arguments[2];\n }\n var surrogatePairs = str.match(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g) || [];\n var len = str.length - surrogatePairs.length;\n return len >= min && (typeof max === 'undefined' || len <= max);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isLowercase;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isLowercase(str) {\n (0, _assertString2.default)(str);\n return str === str.toLowerCase();\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isMACAddress;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;\n\nfunction isMACAddress(str) {\n (0, _assertString2.default)(str);\n return macAddress.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isMobilePhone;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-disable max-len */\nvar phones = {\n 'ar-SY': /^(!?(\\+?963)|0)?9\\d{8}$/,\n 'en-US': /^(\\+?1)?[2-9]\\d{2}[2-9](?!11)\\d{6}$/,\n 'cs-CZ': /^(\\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,\n 'de-DE': /^(\\+?49[ \\.\\-])?([\\(]{1}[0-9]{1,6}[\\)])?([0-9 \\.\\-\\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,\n 'el-GR': /^(\\+?30)?(69\\d{8})$/,\n 'en-AU': /^(\\+?61|0)4\\d{8}$/,\n 'en-GB': /^(\\+?44|0)7\\d{9}$/,\n 'en-HK': /^(\\+?852\\-?)?[569]\\d{3}\\-?\\d{4}$/,\n 'en-IN': /^(\\+?91|0)?[789]\\d{9}$/,\n 'en-NZ': /^(\\+?64|0)2\\d{7,9}$/,\n 'en-ZA': /^(\\+?27|0)\\d{9}$/,\n 'en-ZM': /^(\\+?26)?09[567]\\d{7}$/,\n 'es-ES': /^(\\+?34)?(6\\d{1}|7[1234])\\d{7}$/,\n 'fi-FI': /^(\\+?358|0)\\s?(4(0|1|2|4|5)?|50)\\s?(\\d\\s?){4,8}\\d$/,\n 'fr-FR': /^(\\+?33|0)[67]\\d{8}$/,\n 'ms-MY': /^(\\+?6?01){1}(([145]{1}(\\-|\\s)?\\d{7,8})|([236789]{1}(\\s|\\-)?\\d{7}))$/,\n 'nb-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'nn-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'pt-BR': /^(\\+?55|0)\\-?[1-9]{2}\\-?[2-9]{1}\\d{3,4}\\-?\\d{4}$/,\n 'pt-PT': /^(\\+?351)?9[1236]\\d{7}$/,\n 'ru-RU': /^(\\+?7|8)?9\\d{9}$/,\n 'tr-TR': /^(\\+?90|0)?5\\d{9}$/,\n 'vi-VN': /^(\\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,\n 'zh-CN': /^(\\+?0?86\\-?)?((13\\d|14[57]|15[^4,\\D]|17[678]|18\\d)\\d{8}|170[059]\\d{7})$/,\n 'zh-TW': /^(\\+?886\\-?|0)?9\\d{8}$/\n};\n/* eslint-enable max-len */\n\nfunction isMobilePhone(str, locale) {\n (0, _assertString2.default)(str);\n if (locale in phones) {\n return phones[locale].test(str);\n }\n return false;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isMongoId;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _isHexadecimal = require('./isHexadecimal');\n\nvar _isHexadecimal2 = _interopRequireDefault(_isHexadecimal);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isMongoId(str) {\n (0, _assertString2.default)(str);\n return (0, _isHexadecimal2.default)(str) && str.length === 24;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isMultibyte;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar multibyte = /[^\\x00-\\x7F]/;\n\nfunction isMultibyte(str) {\n (0, _assertString2.default)(str);\n return multibyte.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isNull;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isNull(str) {\n (0, _assertString2.default)(str);\n return str.length === 0;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isNumeric;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar numeric = /^[-+]?[0-9]+$/;\n\nfunction isNumeric(str) {\n (0, _assertString2.default)(str);\n return numeric.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isSurrogatePair;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar surrogatePair = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/;\n\nfunction isSurrogatePair(str) {\n (0, _assertString2.default)(str);\n return surrogatePair.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isURL;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _isFQDN = require('./isFQDN');\n\nvar _isFQDN2 = _interopRequireDefault(_isFQDN);\n\nvar _isIP = require('./isIP');\n\nvar _isIP2 = _interopRequireDefault(_isIP);\n\nvar _merge = require('./util/merge');\n\nvar _merge2 = _interopRequireDefault(_merge);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_url_options = {\n protocols: ['http', 'https', 'ftp'],\n require_tld: true,\n require_protocol: false,\n require_valid_protocol: true,\n allow_underscores: false,\n allow_trailing_dot: false,\n allow_protocol_relative_urls: false\n};\n\nfunction isURL(url, options) {\n (0, _assertString2.default)(url);\n if (!url || url.length >= 2083 || /\\s/.test(url)) {\n return false;\n }\n if (url.indexOf('mailto:') === 0) {\n return false;\n }\n options = (0, _merge2.default)(options, default_url_options);\n var protocol = void 0,\n auth = void 0,\n host = void 0,\n hostname = void 0,\n port = void 0,\n port_str = void 0,\n split = void 0;\n\n split = url.split('#');\n url = split.shift();\n\n split = url.split('?');\n url = split.shift();\n\n split = url.split('://');\n if (split.length > 1) {\n protocol = split.shift();\n if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {\n return false;\n }\n } else if (options.require_protocol) {\n return false;\n } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') {\n split[0] = url.substr(2);\n }\n url = split.join('://');\n\n split = url.split('/');\n url = split.shift();\n split = url.split('@');\n if (split.length > 1) {\n auth = split.shift();\n if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {\n return false;\n }\n }\n hostname = split.join('@');\n split = hostname.split(':');\n host = split.shift();\n if (split.length) {\n port_str = split.join(':');\n port = parseInt(port_str, 10);\n if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {\n return false;\n }\n }\n if (!(0, _isIP2.default)(host) && !(0, _isFQDN2.default)(host, options) && host !== 'localhost') {\n return false;\n }\n if (options.host_whitelist && options.host_whitelist.indexOf(host) === -1) {\n return false;\n }\n if (options.host_blacklist && options.host_blacklist.indexOf(host) !== -1) {\n return false;\n }\n return true;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isUUID;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar uuid = {\n 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,\n 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,\n 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,\n all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i\n};\n\nfunction isUUID(str) {\n var version = arguments.length <= 1 || arguments[1] === undefined ? 'all' : arguments[1];\n\n (0, _assertString2.default)(str);\n var pattern = uuid[version];\n return pattern && pattern.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isUppercase;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isUppercase(str) {\n (0, _assertString2.default)(str);\n return str === str.toUpperCase();\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isVariableWidth;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _isFullWidth = require('./isFullWidth');\n\nvar _isHalfWidth = require('./isHalfWidth');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isVariableWidth(str) {\n (0, _assertString2.default)(str);\n return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isWhitelisted;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction isWhitelisted(str, chars) {\n (0, _assertString2.default)(str);\n for (var i = str.length - 1; i >= 0; i--) {\n if (chars.indexOf(str[i]) === -1) {\n return false;\n }\n }\n return true;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = ltrim;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction ltrim(str, chars) {\n (0, _assertString2.default)(str);\n var pattern = chars ? new RegExp('^[' + chars + ']+', 'g') : /^\\s+/g;\n return str.replace(pattern, '');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = matches;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction matches(str, pattern, modifiers) {\n (0, _assertString2.default)(str);\n if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {\n pattern = new RegExp(pattern, modifiers);\n }\n return pattern.test(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = normalizeEmail;\n\nvar _isEmail = require('./isEmail');\n\nvar _isEmail2 = _interopRequireDefault(_isEmail);\n\nvar _merge = require('./util/merge');\n\nvar _merge2 = _interopRequireDefault(_merge);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_normalize_email_options = {\n lowercase: true,\n remove_dots: true,\n remove_extension: true\n};\n\nfunction normalizeEmail(email, options) {\n options = (0, _merge2.default)(options, default_normalize_email_options);\n if (!(0, _isEmail2.default)(email)) {\n return false;\n }\n var parts = email.split('@', 2);\n parts[1] = parts[1].toLowerCase();\n if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') {\n if (options.remove_extension) {\n parts[0] = parts[0].split('+')[0];\n }\n if (options.remove_dots) {\n parts[0] = parts[0].replace(/\\./g, '');\n }\n if (!parts[0].length) {\n return false;\n }\n parts[0] = parts[0].toLowerCase();\n parts[1] = 'gmail.com';\n } else if (options.lowercase) {\n parts[0] = parts[0].toLowerCase();\n }\n return parts.join('@');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = rtrim;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction rtrim(str, chars) {\n (0, _assertString2.default)(str);\n var pattern = chars ? new RegExp('[' + chars + ']+$', 'g') : /\\s+$/g;\n return str.replace(pattern, '');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = stripLow;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nvar _blacklist = require('./blacklist');\n\nvar _blacklist2 = _interopRequireDefault(_blacklist);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stripLow(str, keep_new_lines) {\n (0, _assertString2.default)(str);\n var chars = keep_new_lines ? '\\\\x00-\\\\x09\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F' : '\\\\x00-\\\\x1F\\\\x7F';\n return (0, _blacklist2.default)(str, chars);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = toBoolean;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction toBoolean(str, strict) {\n (0, _assertString2.default)(str);\n if (strict) {\n return str === '1' || str === 'true';\n }\n return str !== '0' && str !== 'false' && str !== '';\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = toDate;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction toDate(date) {\n (0, _assertString2.default)(date);\n date = Date.parse(date);\n return !isNaN(date) ? new Date(date) : null;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = toFloat;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction toFloat(str) {\n (0, _assertString2.default)(str);\n return parseFloat(str);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = toInt;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction toInt(str, radix) {\n (0, _assertString2.default)(str);\n return parseInt(str, radix || 10);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = trim;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction trim(str, chars) {\n (0, _assertString2.default)(str);\n var pattern = chars ? new RegExp('^[' + chars + ']+|[' + chars + ']+$', 'g') : /^\\s+|\\s+$/g;\n return str.replace(pattern, '');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = unescape;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction unescape(str) {\n (0, _assertString2.default)(str);\n return str.replace(/&/g, '&').replace(/"/g, '\"').replace(/'/g, \"'\").replace(/</g, '<').replace(/>/g, '>').replace(///g, '\\/').replace(/`/g, '\\`');\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = assertString;\nfunction assertString(input) {\n if (typeof input !== 'string') {\n throw new TypeError('This library (validator.js) validates strings only');\n }\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = merge;\nfunction merge() {\n var obj = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n var defaults = arguments[1];\n\n for (var key in defaults) {\n if (typeof obj[key] === 'undefined') {\n obj[key] = defaults[key];\n }\n }\n return obj;\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = toString;\nfunction toString(input) {\n if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && input !== null) {\n if (typeof input.toString === 'function') {\n input = input.toString();\n } else {\n input = '[object Object]';\n }\n } else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) {\n input = '';\n }\n return String(input);\n}\nmodule.exports = exports['default'];", - "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = whitelist;\n\nvar _assertString = require('./util/assertString');\n\nvar _assertString2 = _interopRequireDefault(_assertString);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction whitelist(str, chars) {\n (0, _assertString2.default)(str);\n return str.replace(new RegExp('[^' + chars + ']+', 'g'), '');\n}\nmodule.exports = exports['default'];", + "/*!\n * Copyright (c) 2015 Chris O'Hara \n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n(function (name, definition) {\n if (typeof exports !== 'undefined' && typeof module !== 'undefined') {\n module.exports = definition();\n } else if (typeof define === 'function' && typeof define.amd === 'object') {\n define(definition);\n } else if (typeof define === 'function' && typeof define.petal === 'object') {\n define(name, [], definition);\n } else {\n this[name] = definition();\n }\n})('validator', function (validator) {\n\n 'use strict';\n\n validator = { version: '4.4.0' };\n\n var emailUserPart = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]+$/i;\n var quotedEmailUser = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]))*$/i;\n\n var emailUserUtf8Part = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+$/i;\n var quotedEmailUserUtf8 = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*$/i;\n\n var displayName = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF\\s]*<(.+)>$/i;\n\n var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$/;\n\n var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;\n\n var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/\n , isbn13Maybe = /^(?:[0-9]{13})$/;\n\n var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;\n\n var ipv4Maybe = /^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/\n , ipv6Block = /^[0-9A-F]{1,4}$/i;\n\n var uuid = {\n '3': /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i\n , '4': /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i\n , '5': /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i\n , all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i\n };\n\n var alpha = /^[A-Z]+$/i\n , alphanumeric = /^[0-9A-Z]+$/i\n , numeric = /^[-+]?[0-9]+$/\n , int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/\n , float = /^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$/\n , hexadecimal = /^[0-9A-F]+$/i\n , decimal = /^[-+]?([0-9]+|\\.[0-9]+|[0-9]+\\.[0-9]+)$/\n , hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;\n\n var ascii = /^[\\x00-\\x7F]+$/\n , multibyte = /[^\\x00-\\x7F]/\n , fullWidth = /[^\\u0020-\\u007E\\uFF61-\\uFF9F\\uFFA0-\\uFFDC\\uFFE8-\\uFFEE0-9a-zA-Z]/\n , halfWidth = /[\\u0020-\\u007E\\uFF61-\\uFF9F\\uFFA0-\\uFFDC\\uFFE8-\\uFFEE0-9a-zA-Z]/;\n\n var surrogatePair = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/;\n\n var base64 = /^(?:[A-Z0-9+\\/]{4})*(?:[A-Z0-9+\\/]{2}==|[A-Z0-9+\\/]{3}=|[A-Z0-9+\\/]{4})$/i;\n\n var phones = {\n 'zh-CN': /^(\\+?0?86\\-?)?1[345789]\\d{9}$/,\n 'zh-TW': /^(\\+?886\\-?|0)?9\\d{8}$/,\n 'en-ZA': /^(\\+?27|0)\\d{9}$/,\n 'en-AU': /^(\\+?61|0)4\\d{8}$/,\n 'en-HK': /^(\\+?852\\-?)?[569]\\d{3}\\-?\\d{4}$/,\n 'fr-FR': /^(\\+?33|0)[67]\\d{8}$/,\n 'pt-PT': /^(\\+351)?9[1236]\\d{7}$/,\n 'el-GR': /^(\\+30)?((2\\d{9})|(69\\d{8}))$/,\n 'en-GB': /^(\\+?44|0)7\\d{9}$/,\n 'en-US': /^(\\+?1)?[2-9]\\d{2}[2-9](?!11)\\d{6}$/,\n 'en-ZM': /^(\\+26)?09[567]\\d{7}$/,\n 'ru-RU': /^(\\+?7|8)?9\\d{9}$/,\n 'nb-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'nn-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'vi-VN': /^(0|\\+?84)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,\n 'en-NZ': /^(\\+?64|0)2\\d{7,9}$/\n };\n\n // from http://goo.gl/0ejHHW\n var iso8601 = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n validator.extend = function (name, fn) {\n validator[name] = function () {\n var args = Array.prototype.slice.call(arguments);\n args[0] = validator.toString(args[0]);\n return fn.apply(validator, args);\n };\n };\n\n //Right before exporting the validator object, pass each of the builtins\n //through extend() so that their first argument is coerced to a string\n validator.init = function () {\n for (var name in validator) {\n if (typeof validator[name] !== 'function' || name === 'toString' ||\n name === 'toDate' || name === 'extend' || name === 'init') {\n continue;\n }\n validator.extend(name, validator[name]);\n }\n };\n\n validator.toString = function (input) {\n if (typeof input === 'object' && input !== null && input.toString) {\n input = input.toString();\n } else if (input === null || typeof input === 'undefined' || (isNaN(input) && !input.length)) {\n input = '';\n }\n return '' + input;\n };\n\n validator.toDate = function (date) {\n if (Object.prototype.toString.call(date) === '[object Date]') {\n return date;\n }\n date = Date.parse(date);\n return !isNaN(date) ? new Date(date) : null;\n };\n\n validator.toFloat = function (str) {\n return parseFloat(str);\n };\n\n validator.toInt = function (str, radix) {\n return parseInt(str, radix || 10);\n };\n\n validator.toBoolean = function (str, strict) {\n if (strict) {\n return str === '1' || str === 'true';\n }\n return str !== '0' && str !== 'false' && str !== '';\n };\n\n validator.equals = function (str, comparison) {\n return str === validator.toString(comparison);\n };\n\n validator.contains = function (str, elem) {\n return str.indexOf(validator.toString(elem)) >= 0;\n };\n\n validator.matches = function (str, pattern, modifiers) {\n if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {\n pattern = new RegExp(pattern, modifiers);\n }\n return pattern.test(str);\n };\n\n var default_email_options = {\n allow_display_name: false,\n allow_utf8_local_part: true,\n require_tld: true\n };\n\n validator.isEmail = function (str, options) {\n options = merge(options, default_email_options);\n\n if (options.allow_display_name) {\n var display_email = str.match(displayName);\n if (display_email) {\n str = display_email[1];\n }\n }\n\n var parts = str.split('@')\n , domain = parts.pop()\n , user = parts.join('@');\n\n var lower_domain = domain.toLowerCase();\n if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {\n user = user.replace(/\\./g, '').toLowerCase();\n }\n\n if (!validator.isByteLength(user, 0, 64) ||\n !validator.isByteLength(domain, 0, 256)) {\n return false;\n }\n\n if (!validator.isFQDN(domain, {require_tld: options.require_tld})) {\n return false;\n }\n\n if (user[0] === '\"') {\n user = user.slice(1, user.length - 1);\n return options.allow_utf8_local_part ?\n quotedEmailUserUtf8.test(user) :\n quotedEmailUser.test(user);\n }\n\n var pattern = options.allow_utf8_local_part ?\n emailUserUtf8Part : emailUserPart;\n\n var user_parts = user.split('.');\n for (var i = 0; i < user_parts.length; i++) {\n if (!pattern.test(user_parts[i])) {\n return false;\n }\n }\n\n return true;\n };\n\n var default_url_options = {\n protocols: [ 'http', 'https', 'ftp' ]\n , require_tld: true\n , require_protocol: false\n , require_valid_protocol: true\n , allow_underscores: false\n , allow_trailing_dot: false\n , allow_protocol_relative_urls: false\n };\n\n validator.isURL = function (url, options) {\n if (!url || url.length >= 2083 || /\\s/.test(url)) {\n return false;\n }\n if (url.indexOf('mailto:') === 0) {\n return false;\n }\n options = merge(options, default_url_options);\n var protocol, auth, host, hostname, port,\n port_str, split;\n split = url.split('://');\n if (split.length > 1) {\n protocol = split.shift();\n if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {\n return false;\n }\n } else if (options.require_protocol) {\n return false;\n } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') {\n split[0] = url.substr(2);\n }\n url = split.join('://');\n split = url.split('#');\n url = split.shift();\n\n split = url.split('?');\n url = split.shift();\n\n split = url.split('/');\n url = split.shift();\n split = url.split('@');\n if (split.length > 1) {\n auth = split.shift();\n if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {\n return false;\n }\n }\n hostname = split.join('@');\n split = hostname.split(':');\n host = split.shift();\n if (split.length) {\n port_str = split.join(':');\n port = parseInt(port_str, 10);\n if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {\n return false;\n }\n }\n if (!validator.isIP(host) && !validator.isFQDN(host, options) &&\n host !== 'localhost') {\n return false;\n }\n if (options.host_whitelist &&\n options.host_whitelist.indexOf(host) === -1) {\n return false;\n }\n if (options.host_blacklist &&\n options.host_blacklist.indexOf(host) !== -1) {\n return false;\n }\n return true;\n };\n\n validator.isMACAddress = function (str) {\n return macAddress.test(str);\n };\n\n validator.isIP = function (str, version) {\n version = validator.toString(version);\n if (!version) {\n return validator.isIP(str, 4) || validator.isIP(str, 6);\n } else if (version === '4') {\n if (!ipv4Maybe.test(str)) {\n return false;\n }\n var parts = str.split('.').sort(function (a, b) {\n return a - b;\n });\n return parts[3] <= 255;\n } else if (version === '6') {\n var blocks = str.split(':');\n var foundOmissionBlock = false; // marker to indicate ::\n\n // At least some OS accept the last 32 bits of an IPv6 address\n // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says\n // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,\n // and '::a.b.c.d' is deprecated, but also valid.\n var foundIPv4TransitionBlock = validator.isIP(blocks[blocks.length - 1], 4);\n var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;\n\n if (blocks.length > expectedNumberOfBlocks)\n return false;\n\n // initial or final ::\n if (str === '::') {\n return true;\n } else if (str.substr(0, 2) === '::') {\n blocks.shift();\n blocks.shift();\n foundOmissionBlock = true;\n } else if (str.substr(str.length - 2) === '::') {\n blocks.pop();\n blocks.pop();\n foundOmissionBlock = true;\n }\n\n for (var i = 0; i < blocks.length; ++i) {\n // test for a :: which can not be at the string start/end\n // since those cases have been handled above\n if (blocks[i] === '' && i > 0 && i < blocks.length -1) {\n if (foundOmissionBlock)\n return false; // multiple :: in address\n foundOmissionBlock = true;\n } else if (foundIPv4TransitionBlock && i == blocks.length - 1) {\n // it has been checked before that the last\n // block is a valid IPv4 address\n } else if (!ipv6Block.test(blocks[i])) {\n return false;\n }\n }\n\n if (foundOmissionBlock) {\n return blocks.length >= 1;\n } else {\n return blocks.length === expectedNumberOfBlocks;\n }\n }\n return false;\n };\n\n var default_fqdn_options = {\n require_tld: true\n , allow_underscores: false\n , allow_trailing_dot: false\n };\n\n validator.isFQDN = function (str, options) {\n options = merge(options, default_fqdn_options);\n\n /* Remove the optional trailing dot before checking validity */\n if (options.allow_trailing_dot && str[str.length - 1] === '.') {\n str = str.substring(0, str.length - 1);\n }\n var parts = str.split('.');\n if (options.require_tld) {\n var tld = parts.pop();\n if (!parts.length || !/^([a-z\\u00a1-\\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {\n return false;\n }\n }\n for (var part, i = 0; i < parts.length; i++) {\n part = parts[i];\n if (options.allow_underscores) {\n if (part.indexOf('__') >= 0) {\n return false;\n }\n part = part.replace(/_/g, '');\n }\n if (!/^[a-z\\u00a1-\\uffff0-9-]+$/i.test(part)) {\n return false;\n }\n if (/[\\uff01-\\uff5e]/.test(part)) {\n // disallow full-width chars\n return false;\n }\n if (part[0] === '-' || part[part.length - 1] === '-' ||\n part.indexOf('---') >= 0) {\n return false;\n }\n }\n return true;\n };\n\n validator.isBoolean = function(str) {\n return (['true', 'false', '1', '0'].indexOf(str) >= 0);\n };\n\n validator.isAlpha = function (str) {\n return alpha.test(str);\n };\n\n validator.isAlphanumeric = function (str) {\n return alphanumeric.test(str);\n };\n\n validator.isNumeric = function (str) {\n return numeric.test(str);\n };\n\n validator.isDecimal = function (str) {\n return str !== '' && decimal.test(str);\n };\n\n validator.isHexadecimal = function (str) {\n return hexadecimal.test(str);\n };\n\n validator.isHexColor = function (str) {\n return hexcolor.test(str);\n };\n\n validator.isLowercase = function (str) {\n return str === str.toLowerCase();\n };\n\n validator.isUppercase = function (str) {\n return str === str.toUpperCase();\n };\n\n validator.isInt = function (str, options) {\n options = options || {};\n return int.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);\n };\n\n validator.isFloat = function (str, options) {\n options = options || {};\n if (str === '' || str === '.') {\n return false;\n }\n return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);\n };\n\n validator.isDivisibleBy = function (str, num) {\n return validator.toFloat(str) % validator.toInt(num) === 0;\n };\n\n validator.isNull = function (str) {\n return str.length === 0;\n };\n\n validator.isLength = function (str, min, max) {\n var surrogatePairs = str.match(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g) || [];\n var len = str.length - surrogatePairs.length;\n return len >= min && (typeof max === 'undefined' || len <= max);\n };\n\n validator.isByteLength = function (str, min, max) {\n var len = encodeURI(str).split(/%..|./).length - 1;\n return len >= min && (typeof max === 'undefined' || len <= max);\n };\n\n validator.isUUID = function (str, version) {\n var pattern = uuid[version ? version : 'all'];\n return pattern && pattern.test(str);\n };\n\n function getTimezoneOffset(str) {\n var iso8601Parts = str.match(iso8601)\n , timezone, sign, hours, minutes;\n if (!iso8601Parts) {\n str = str.toLowerCase();\n timezone = str.match(/(?:\\s|gmt\\s*)(-|\\+)(\\d{1,4})(\\s|$)/);\n if (!timezone) {\n return str.indexOf('gmt') !== -1 ? 0 : null;\n }\n sign = timezone[1];\n var offset = timezone[2];\n if (offset.length === 3) {\n offset = '0' + offset;\n }\n if (offset.length <= 2) {\n hours = 0;\n minutes = parseInt(offset);\n } else {\n hours = parseInt(offset.slice(0, 2));\n minutes = parseInt(offset.slice(2, 4));\n }\n } else {\n timezone = iso8601Parts[21];\n if (!timezone || timezone === 'z' || timezone === 'Z') {\n return 0;\n }\n sign = iso8601Parts[22];\n if (timezone.indexOf(':') !== -1) {\n hours = parseInt(iso8601Parts[23]);\n minutes = parseInt(iso8601Parts[24]);\n } else {\n hours = 0;\n minutes = parseInt(iso8601Parts[23]);\n }\n }\n return (hours * 60 + minutes) * (sign === '-' ? 1 : -1);\n }\n\n validator.isDate = function (str) {\n var normalizedDate = new Date(Date.parse(str));\n if (isNaN(normalizedDate)) {\n return false;\n }\n // normalizedDate is in the user's timezone. Apply the input\n // timezone offset to the date so that the year and day match\n // the input\n var timezoneOffset = getTimezoneOffset(str);\n if (timezoneOffset !== null) {\n var timezoneDifference = normalizedDate.getTimezoneOffset() -\n timezoneOffset;\n normalizedDate = new Date(normalizedDate.getTime() +\n 60000 * timezoneDifference);\n }\n var day = String(normalizedDate.getDate());\n var dayOrYear, dayOrYearMatches, year;\n //check for valid double digits that could be late days\n //check for all matches since a string like '12/23' is a valid date\n //ignore everything with nearby colons\n dayOrYearMatches = str.match(/(^|[^:\\d])[23]\\d([^:\\d]|$)/g);\n if (!dayOrYearMatches) {\n return true;\n }\n dayOrYear = dayOrYearMatches.map(function(digitString) {\n return digitString.match(/\\d+/g)[0];\n }).join('/');\n year = String(normalizedDate.getFullYear()).slice(-2);\n if (dayOrYear === day || dayOrYear === year) {\n return true;\n } else if ((dayOrYear === (day + '/' + year)) || (dayOrYear === (year + '/' + day))) {\n return true;\n }\n return false;\n };\n\n validator.isAfter = function (str, date) {\n var comparison = validator.toDate(date || new Date())\n , original = validator.toDate(str);\n return !!(original && comparison && original > comparison);\n };\n\n validator.isBefore = function (str, date) {\n var comparison = validator.toDate(date || new Date())\n , original = validator.toDate(str);\n return !!(original && comparison && original < comparison);\n };\n\n validator.isIn = function (str, options) {\n var i;\n if (Object.prototype.toString.call(options) === '[object Array]') {\n var array = [];\n for (i in options) {\n array[i] = validator.toString(options[i]);\n }\n return array.indexOf(str) >= 0;\n } else if (typeof options === 'object') {\n return options.hasOwnProperty(str);\n } else if (options && typeof options.indexOf === 'function') {\n return options.indexOf(str) >= 0;\n }\n return false;\n };\n\n validator.isWhitelisted = function (str, chars) {\n for (var i = str.length - 1; i >= 0; i--) {\n if (chars.indexOf(str[i]) === -1) {\n return false;\n }\n }\n\n return true;\n };\n\n validator.isCreditCard = function (str) {\n var sanitized = str.replace(/[^0-9]+/g, '');\n if (!creditCard.test(sanitized)) {\n return false;\n }\n var sum = 0, digit, tmpNum, shouldDouble;\n for (var i = sanitized.length - 1; i >= 0; i--) {\n digit = sanitized.substring(i, (i + 1));\n tmpNum = parseInt(digit, 10);\n if (shouldDouble) {\n tmpNum *= 2;\n if (tmpNum >= 10) {\n sum += ((tmpNum % 10) + 1);\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n shouldDouble = !shouldDouble;\n }\n return !!((sum % 10) === 0 ? sanitized : false);\n };\n\n validator.isISIN = function (str) {\n if (!isin.test(str)) {\n return false;\n }\n\n var checksumStr = str.replace(/[A-Z]/g, function(character) {\n return parseInt(character, 36);\n });\n\n var sum = 0, digit, tmpNum, shouldDouble = true;\n for (var i = checksumStr.length - 2; i >= 0; i--) {\n digit = checksumStr.substring(i, (i + 1));\n tmpNum = parseInt(digit, 10);\n if (shouldDouble) {\n tmpNum *= 2;\n if (tmpNum >= 10) {\n sum += tmpNum + 1;\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n shouldDouble = !shouldDouble;\n }\n\n return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10;\n };\n\n validator.isISBN = function (str, version) {\n version = validator.toString(version);\n if (!version) {\n return validator.isISBN(str, 10) || validator.isISBN(str, 13);\n }\n var sanitized = str.replace(/[\\s-]+/g, '')\n , checksum = 0, i;\n if (version === '10') {\n if (!isbn10Maybe.test(sanitized)) {\n return false;\n }\n for (i = 0; i < 9; i++) {\n checksum += (i + 1) * sanitized.charAt(i);\n }\n if (sanitized.charAt(9) === 'X') {\n checksum += 10 * 10;\n } else {\n checksum += 10 * sanitized.charAt(9);\n }\n if ((checksum % 11) === 0) {\n return !!sanitized;\n }\n } else if (version === '13') {\n if (!isbn13Maybe.test(sanitized)) {\n return false;\n }\n var factor = [ 1, 3 ];\n for (i = 0; i < 12; i++) {\n checksum += factor[i % 2] * sanitized.charAt(i);\n }\n if (sanitized.charAt(12) - ((10 - (checksum % 10)) % 10) === 0) {\n return !!sanitized;\n }\n }\n return false;\n };\n\n validator.isMobilePhone = function(str, locale) {\n if (locale in phones) {\n return phones[locale].test(str);\n }\n return false;\n };\n\n var default_currency_options = {\n symbol: '$'\n , require_symbol: false\n , allow_space_after_symbol: false\n , symbol_after_digits: false\n , allow_negatives: true\n , parens_for_negatives: false\n , negative_sign_before_digits: false\n , negative_sign_after_digits: false\n , allow_negative_sign_placeholder: false\n , thousands_separator: ','\n , decimal_separator: '.'\n , allow_space_after_digits: false\n };\n\n validator.isCurrency = function (str, options) {\n options = merge(options, default_currency_options);\n\n return currencyRegex(options).test(str);\n };\n\n validator.isJSON = function (str) {\n try {\n var obj = JSON.parse(str);\n return !!obj && typeof obj === 'object';\n } catch (e) {}\n return false;\n };\n\n validator.isMultibyte = function (str) {\n return multibyte.test(str);\n };\n\n validator.isAscii = function (str) {\n return ascii.test(str);\n };\n\n validator.isFullWidth = function (str) {\n return fullWidth.test(str);\n };\n\n validator.isHalfWidth = function (str) {\n return halfWidth.test(str);\n };\n\n validator.isVariableWidth = function (str) {\n return fullWidth.test(str) && halfWidth.test(str);\n };\n\n validator.isSurrogatePair = function (str) {\n return surrogatePair.test(str);\n };\n\n validator.isBase64 = function (str) {\n return base64.test(str);\n };\n\n validator.isMongoId = function (str) {\n return validator.isHexadecimal(str) && str.length === 24;\n };\n\n validator.isISO8601 = function (str) {\n return iso8601.test(str);\n };\n\n validator.ltrim = function (str, chars) {\n var pattern = chars ? new RegExp('^[' + chars + ']+', 'g') : /^\\s+/g;\n return str.replace(pattern, '');\n };\n\n validator.rtrim = function (str, chars) {\n var pattern = chars ? new RegExp('[' + chars + ']+$', 'g') : /\\s+$/g;\n return str.replace(pattern, '');\n };\n\n validator.trim = function (str, chars) {\n var pattern = chars ? new RegExp('^[' + chars + ']+|[' + chars + ']+$', 'g') : /^\\s+|\\s+$/g;\n return str.replace(pattern, '');\n };\n\n validator.escape = function (str) {\n return (str.replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(//g, '>')\n .replace(/\\//g, '/')\n .replace(/\\`/g, '`'));\n };\n\n validator.stripLow = function (str, keep_new_lines) {\n var chars = keep_new_lines ? '\\\\x00-\\\\x09\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F' : '\\\\x00-\\\\x1F\\\\x7F';\n return validator.blacklist(str, chars);\n };\n\n validator.whitelist = function (str, chars) {\n return str.replace(new RegExp('[^' + chars + ']+', 'g'), '');\n };\n\n validator.blacklist = function (str, chars) {\n return str.replace(new RegExp('[' + chars + ']+', 'g'), '');\n };\n\n var default_normalize_email_options = {\n lowercase: true,\n remove_dots: true,\n remove_extension: true\n };\n\n validator.normalizeEmail = function (email, options) {\n options = merge(options, default_normalize_email_options);\n if (!validator.isEmail(email)) {\n return false;\n }\n var parts = email.split('@', 2);\n parts[1] = parts[1].toLowerCase();\n if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') {\n if (options.remove_extension) {\n parts[0] = parts[0].split('+')[0];\n }\n if (options.remove_dots) {\n parts[0] = parts[0].replace(/\\./g, '');\n }\n if (!parts[0].length) {\n return false;\n }\n parts[0] = parts[0].toLowerCase();\n parts[1] = 'gmail.com';\n } else if (options.lowercase) {\n parts[0] = parts[0].toLowerCase();\n }\n return parts.join('@');\n };\n\n function merge(obj, defaults) {\n obj = obj || {};\n for (var key in defaults) {\n if (typeof obj[key] === 'undefined') {\n obj[key] = defaults[key];\n }\n }\n return obj;\n }\n\n function currencyRegex(options) {\n var symbol = '(\\\\' + options.symbol.replace(/\\./g, '\\\\.') + ')' + (options.require_symbol ? '' : '?')\n , negative = '-?'\n , whole_dollar_amount_without_sep = '[1-9]\\\\d*'\n , whole_dollar_amount_with_sep = '[1-9]\\\\d{0,2}(\\\\' + options.thousands_separator + '\\\\d{3})*'\n , valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep]\n , whole_dollar_amount = '(' + valid_whole_dollar_amounts.join('|') + ')?'\n , decimal_amount = '(\\\\' + options.decimal_separator + '\\\\d{2})?';\n var pattern = whole_dollar_amount + decimal_amount;\n // default is negative sign before symbol, but there are two other options (besides parens)\n if (options.allow_negatives && !options.parens_for_negatives) {\n if (options.negative_sign_after_digits) {\n pattern += negative;\n }\n else if (options.negative_sign_before_digits) {\n pattern = negative + pattern;\n }\n }\n // South African Rand, for example, uses R 123 (space) and R-123 (no space)\n if (options.allow_negative_sign_placeholder) {\n pattern = '( (?!\\\\-))?' + pattern;\n }\n else if (options.allow_space_after_symbol) {\n pattern = ' ?' + pattern;\n }\n else if (options.allow_space_after_digits) {\n pattern += '( (?!$))?';\n }\n if (options.symbol_after_digits) {\n pattern += symbol;\n } else {\n pattern = symbol + pattern;\n }\n if (options.allow_negatives) {\n if (options.parens_for_negatives) {\n pattern = '(\\\\(' + pattern + '\\\\)|' + pattern + ')';\n }\n else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) {\n pattern = negative + pattern;\n }\n }\n return new RegExp(\n '^' +\n // ensure there's a dollar and/or decimal amount, and that it doesn't start with a space or a negative sign followed by a space\n '(?!-? )(?=.*\\\\d)' +\n pattern +\n '$'\n );\n }\n\n validator.init();\n\n return validator;\n\n});\n", "module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n", "\"use strict\";\n\nmodule.exports = {\n\n INVALID_TYPE: \"Expected type {0} but found type {1}\",\n INVALID_FORMAT: \"Object didn't pass validation for format {0}: {1}\",\n ENUM_MISMATCH: \"No enum match for: {0}\",\n ANY_OF_MISSING: \"Data does not match any schemas from 'anyOf'\",\n ONE_OF_MISSING: \"Data does not match any schemas from 'oneOf'\",\n ONE_OF_MULTIPLE: \"Data is valid against more than one schema from 'oneOf'\",\n NOT_PASSED: \"Data matches schema from 'not'\",\n\n // Array errors\n ARRAY_LENGTH_SHORT: \"Array is too short ({0}), minimum {1}\",\n ARRAY_LENGTH_LONG: \"Array is too long ({0}), maximum {1}\",\n ARRAY_UNIQUE: \"Array items are not unique (indexes {0} and {1})\",\n ARRAY_ADDITIONAL_ITEMS: \"Additional items not allowed\",\n\n // Numeric errors\n MULTIPLE_OF: \"Value {0} is not a multiple of {1}\",\n MINIMUM: \"Value {0} is less than minimum {1}\",\n MINIMUM_EXCLUSIVE: \"Value {0} is equal or less than exclusive minimum {1}\",\n MAXIMUM: \"Value {0} is greater than maximum {1}\",\n MAXIMUM_EXCLUSIVE: \"Value {0} is equal or greater than exclusive maximum {1}\",\n\n // Object errors\n OBJECT_PROPERTIES_MINIMUM: \"Too few properties defined ({0}), minimum {1}\",\n OBJECT_PROPERTIES_MAXIMUM: \"Too many properties defined ({0}), maximum {1}\",\n OBJECT_MISSING_REQUIRED_PROPERTY: \"Missing required property: {0}\",\n OBJECT_ADDITIONAL_PROPERTIES: \"Additional properties not allowed: {0}\",\n OBJECT_DEPENDENCY_KEY: \"Dependency failed - key must exist: {0} (due to key: {1})\",\n\n // String errors\n MIN_LENGTH: \"String is too short ({0} chars), minimum {1}\",\n MAX_LENGTH: \"String is too long ({0} chars), maximum {1}\",\n PATTERN: \"String does not match pattern {0}: {1}\",\n\n // Schema validation errors\n KEYWORD_TYPE_EXPECTED: \"Keyword '{0}' is expected to be of type '{1}'\",\n KEYWORD_UNDEFINED_STRICT: \"Keyword '{0}' must be defined in strict mode\",\n KEYWORD_UNEXPECTED: \"Keyword '{0}' is not expected to appear in the schema\",\n KEYWORD_MUST_BE: \"Keyword '{0}' must be {1}\",\n KEYWORD_DEPENDENCY: \"Keyword '{0}' requires keyword '{1}'\",\n KEYWORD_PATTERN: \"Keyword '{0}' is not a valid RegExp pattern: {1}\",\n KEYWORD_VALUE_TYPE: \"Each element of keyword '{0}' array must be a '{1}'\",\n UNKNOWN_FORMAT: \"There is no validation function for format '{0}'\",\n CUSTOM_MODE_FORCE_PROPERTIES: \"{0} must define at least one property if present\",\n\n // Remote errors\n REF_UNRESOLVED: \"Reference has not been resolved during compilation: {0}\",\n UNRESOLVABLE_REFERENCE: \"Reference could not be resolved: {0}\",\n SCHEMA_NOT_REACHABLE: \"Validator was not able to read schema with uri: {0}\",\n SCHEMA_TYPE_EXPECTED: \"Schema is expected to be of type 'object'\",\n SCHEMA_NOT_AN_OBJECT: \"Schema is not an object: {0}\",\n ASYNC_TIMEOUT: \"{0} asynchronous task(s) have timed out after {1} ms\",\n PARENT_SCHEMA_VALIDATION_FAILED: \"Schema failed to validate against its parent schema, see inner errors for details.\",\n REMOTE_NOT_VALID: \"Remote reference didn't compile successfully: {0}\"\n\n};\n", "/*jshint maxlen: false*/\n\nvar validator = require(\"validator\");\n\nvar FormatValidators = {\n \"date\": function (date) {\n if (typeof date !== \"string\") {\n return true;\n }\n // full-date from http://tools.ietf.org/html/rfc3339#section-5.6\n var matches = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(date);\n if (matches === null) {\n return false;\n }\n // var year = matches[1];\n // var month = matches[2];\n // var day = matches[3];\n if (matches[2] < \"01\" || matches[2] > \"12\" || matches[3] < \"01\" || matches[3] > \"31\") {\n return false;\n }\n return true;\n },\n \"date-time\": function (dateTime) {\n if (typeof dateTime !== \"string\") {\n return true;\n }\n // date-time from http://tools.ietf.org/html/rfc3339#section-5.6\n var s = dateTime.toLowerCase().split(\"t\");\n if (!FormatValidators.date(s[0])) {\n return false;\n }\n var matches = /^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$/.exec(s[1]);\n if (matches === null) {\n return false;\n }\n // var hour = matches[1];\n // var minute = matches[2];\n // var second = matches[3];\n // var fraction = matches[4];\n // var timezone = matches[5];\n if (matches[1] > \"23\" || matches[2] > \"59\" || matches[3] > \"59\") {\n return false;\n }\n return true;\n },\n \"email\": function (email) {\n if (typeof email !== \"string\") {\n return true;\n }\n return validator.isEmail(email, { \"require_tld\": true });\n },\n \"hostname\": function (hostname) {\n if (typeof hostname !== \"string\") {\n return true;\n }\n /*\n http://json-schema.org/latest/json-schema-validation.html#anchor114\n A string instance is valid against this attribute if it is a valid\n representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034].\n\n http://tools.ietf.org/html/rfc1034#section-3.5\n\n ::= any one of the ten digits 0 through 9\n var digit = /[0-9]/;\n\n ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case\n var letter = /[a-zA-Z]/;\n\n ::= | \n var letDig = /[0-9a-zA-Z]/;\n\n ::= | \"-\"\n var letDigHyp = /[-0-9a-zA-Z]/;\n\n ::= | \n var ldhStr = /[-0-9a-zA-Z]+/;\n\n